PG::
Constants module
Constants
- CONNECTION_AUTH_OK
Received authentication; waiting for backend startup.
- CONNECTION_AWAITING_RESPONSE
Waiting for a response from the server.
- CONNECTION_BAD
Connection
failed- CONNECTION_CHECK_STANDBY
Checking if server is in standby mode. Available since PostgreSQL-14.
- CONNECTION_CHECK_TARGET
Checking target server properties. Available since PostgreSQL-13.
- CONNECTION_CHECK_WRITABLE
Checking if session is read-write. Available since PostgreSQL-10.
- CONNECTION_CONSUME
Consuming any extra messages. Available since PostgreSQL-10.
- CONNECTION_GSS_STARTUP
Negotiating GSSAPI. Available since PostgreSQL-12.
- CONNECTION_MADE
Connection
OK; waiting to send.- CONNECTION_NEEDED
Internal state -
PG.connect()
needed.- CONNECTION_OK
Connection
succeeded- CONNECTION_SETENV
This state is no longer used.
- CONNECTION_SSL_STARTUP
Negotiating SSL encryption.
- CONNECTION_STARTED
Waiting for connection to be made.
- DEF_PGPORT
PostgreSQL compiled in default port
- INVALID_OID
Invalid OID constant
- INV_READ
Flag for
Connection#lo_creat
,Connection#lo_open
– open for reading- INV_WRITE
Flag for
Connection#lo_creat
,Connection#lo_open
– open for writing- InvalidOid
- PGRES_BAD_RESPONSE
Result#result_status
constant - The server’s response was not understood.- PGRES_COMMAND_OK
Result#result_status
constant - Successful completion of a command returning no data.- PGRES_COPY_BOTH
Result#result_status
constant - Copy In/Out data transfer in progress.- PGRES_COPY_IN
Result#result_status
constant - Copy In (to server) data transfer started.- PGRES_COPY_OUT
Result#result_status
constant - Copy Out (from server) data transfer started.- PGRES_EMPTY_QUERY
Result#result_status
constant - The string sent to the server was empty.- PGRES_FATAL_ERROR
Result#result_status
constant - A fatal error occurred.- PGRES_NONFATAL_ERROR
Result#result_status
constant - A nonfatal error (a notice or warning) occurred.- PGRES_PIPELINE_ABORTED
Result#result_status
constant - ThePG::Result
represents a pipeline that has received an error from the server.Connection#get_result
must be called repeatedly, and each time it will return this status code until the end of the current pipeline, at which point it will return PG::PGRES_PIPELINE_SYNC and normal processing can resume.- PGRES_PIPELINE_SYNC
Result#result_status
constant - ThePG::Result
represents a synchronization point in pipeline mode, requested byConnection#pipeline_sync
.This status occurs only when pipeline mode has been selected.
- PGRES_POLLING_FAILED
Async connection failed or was reset
- PGRES_POLLING_OK
Async connection succeeded
- PGRES_POLLING_READING
Async connection is waiting to read
- PGRES_POLLING_WRITING
Async connection is waiting to write
- PGRES_SINGLE_TUPLE
Result#result_status
constant - Single tuple from larger resultset.- PGRES_TUPLES_OK
Result#result_status
constant - Successful completion of a command returning data (such as a SELECT or SHOW).- PG_DIAG_COLUMN_NAME
Result#result_error_field
argument constantIf the error was associated with a specific table column, the name of the column. (When this field is present, the schema and table name fields identify the table.)
- PG_DIAG_CONSTRAINT_NAME
Result#result_error_field
argument constantIf the error was associated with a specific constraint, the name of the constraint. The table or domain that the constraint belongs to is reported using the fields listed above. (For this purpose, indexes are treated as constraints, even if they weren’t created with constraint syntax.)
- PG_DIAG_CONTEXT
Result#result_error_field
argument constantAn indication of the context in which the error occurred. Presently this includes a call stack traceback of active procedural language functions and internally-generated queries. The trace is one entry per line, most recent first.
- PG_DIAG_DATATYPE_NAME
Result#result_error_field
argument constantIf the error was associated with a specific datatype, the name of the datatype. (When this field is present, the schema name field provides the name of the datatype’s schema.)
- PG_DIAG_INTERNAL_POSITION
Result#result_error_field
argument constantThis is defined the same as the
PG_DIAG_STATEMENT_POSITION
field, but it is used when the cursor position refers to an internally generated command rather than the one submitted by the client. ThePG_DIAG_INTERNAL_QUERY
field will always appear when this field appears.- PG_DIAG_INTERNAL_QUERY
Result#result_error_field
argument constantThe text of a failed internally-generated command. This could be, for example, a SQL query issued by a PL/pgSQL function.
- PG_DIAG_MESSAGE_DETAIL
Result#result_error_field
argument constantDetail: an optional secondary error message carrying more detail about the problem. Might run to multiple lines.
- PG_DIAG_MESSAGE_HINT
Result#result_error_field
argument constantHint: an optional suggestion what to do about the problem. This is intended to differ from detail in that it offers advice (potentially inappropriate) rather than hard facts. Might run to multiple lines.
- PG_DIAG_MESSAGE_PRIMARY
Result#result_error_field
argument constantThe primary human-readable error message (typically one line). Always present.
- PG_DIAG_SCHEMA_NAME
Result#result_error_field
argument constantIf the error was associated with a specific database object, the name of the schema containing that object, if any.
- PG_DIAG_SEVERITY
Result#result_error_field
argument constantThe severity; the field contents are ERROR, FATAL, or PANIC (in an error message), or WARNING, NOTICE, DEBUG, INFO, or LOG (in a notice message), or a localized translation of one of these. Always present.
- PG_DIAG_SEVERITY_NONLOCALIZED
Result#result_error_field
argument constantThe severity; the field contents are ERROR, FATAL, or PANIC (in an error message), or WARNING, NOTICE, DEBUG, INFO, or LOG (in a notice message). This is identical to the
PG_DIAG_SEVERITY
field except that the contents are never localized.Available since PostgreSQL-9.6
- PG_DIAG_SOURCE_FILE
Result#result_error_field
argument constantThe file name of the source-code location where the error was reported.
- PG_DIAG_SOURCE_FUNCTION
Result#result_error_field
argument constantThe name of the source-code function reporting the error.
- PG_DIAG_SOURCE_LINE
Result#result_error_field
argument constantThe line number of the source-code location where the error was reported.
- PG_DIAG_SQLSTATE
Result#result_error_field
argument constantThe SQLSTATE code for the error. The SQLSTATE code identifies the type of error that has occurred; it can be used by front-end applications to perform specific operations (such as error handling) in response to a particular database error. For a list of the possible SQLSTATE codes, see Appendix A. This field is not localizable, and is always present.
- PG_DIAG_STATEMENT_POSITION
Result#result_error_field
argument constantA string containing a decimal integer indicating an error cursor position as an index into the original statement string.
The first character has index 1, and positions are measured in characters not bytes.
- PG_DIAG_TABLE_NAME
Result#result_error_field
argument constantIf the error was associated with a specific table, the name of the table. (When this field is present, the schema name field provides the name of the table’s schema.)
- PQERRORS_DEFAULT
Error
verbosity level (Connection#set_error_verbosity
). The DEFAULT mode produces messages that include the above plus any detail, hint, or context fields (these might span multiple lines).- PQERRORS_SQLSTATE
Error
verbosity level (Connection#set_error_verbosity
). The SQLSTATE mode includes only the error severity and the SQLSTATE error code, if one is available (if not, the output is like TERSE mode).Available since PostgreSQL-12.
- PQERRORS_TERSE
Error
verbosity level (Connection#set_error_verbosity
). In TERSE mode, returned messages include severity, primary text, and position only; this will normally fit on a single line.- PQERRORS_VERBOSE
Error
verbosity level (Connection#set_error_verbosity
). The VERBOSE mode includes all available fields.- PQPING_NO_ATTEMPT
Connection
not attempted (bad params).- PQPING_NO_RESPONSE
Could not establish connection.
- PQPING_OK
Server is accepting connections.
- PQPING_REJECT
Server is alive but rejecting connections.
- PQSHOW_CONTEXT_ALWAYS
- PQSHOW_CONTEXT_ERRORS
- PQSHOW_CONTEXT_NEVER
- PQTRANS_ACTIVE
Transaction is currently active; query has been sent to the server, but not yet completed. (
Connection#transaction_status
)- PQTRANS_IDLE
Transaction is currently idle (
Connection#transaction_status
)- PQTRANS_INERROR
Transaction is currently idle, in a failed transaction block (
Connection#transaction_status
)- PQTRANS_INTRANS
Transaction is currently idle, in a valid transaction block (
Connection#transaction_status
)- PQTRANS_UNKNOWN
Transaction’s connection is bad (
Connection#transaction_status
)- PQ_PIPELINE_ABORTED
Connection#pipeline_status
constantThe libpq connection is in pipeline mode and an error occurred while processing the current pipeline. The aborted flag is cleared when PQgetResult returns a result of type
PGRES_PIPELINE_SYNC
.- PQ_PIPELINE_OFF
Connection#pipeline_status
constantThe libpq connection is not in pipeline mode.
- PQ_PIPELINE_ON
Connection#pipeline_status
constantThe libpq connection is in pipeline mode.
- SEEK_CUR
Flag for
Connection#lo_lseek
– seek from current position- SEEK_END
Flag for
Connection#lo_lseek
– seek from object end- SEEK_SET
Flag for
Connection#lo_lseek
– seek from object start