Module: PG::Constants

Included in:
PG, Connection
Defined in:
ext/pg.c

Constant Summary collapse

CONNECTION_OK =

Connection succeeded

INT2FIX(CONNECTION_OK)
CONNECTION_BAD =

Connection failed

INT2FIX(CONNECTION_BAD)
CONNECTION_STARTED =

Waiting for connection to be made.

INT2FIX(CONNECTION_STARTED)
CONNECTION_MADE =

Connection OK; waiting to send.

INT2FIX(CONNECTION_MADE)
CONNECTION_AWAITING_RESPONSE =

Waiting for a response from the server.

INT2FIX(CONNECTION_AWAITING_RESPONSE)
CONNECTION_AUTH_OK =

Received authentication; waiting for backend startup.

INT2FIX(CONNECTION_AUTH_OK)
CONNECTION_SETENV =

This state is no longer used.

INT2FIX(CONNECTION_SETENV)
CONNECTION_SSL_STARTUP =

Negotiating SSL encryption.

INT2FIX(CONNECTION_SSL_STARTUP)
CONNECTION_NEEDED =

Internal state - PG.connect() needed.

INT2FIX(CONNECTION_NEEDED)
CONNECTION_CHECK_WRITABLE =

Checking if session is read-write. Available since PostgreSQL-10.

INT2FIX(CONNECTION_CHECK_WRITABLE)
CONNECTION_CONSUME =

Consuming any extra messages. Available since PostgreSQL-10.

INT2FIX(CONNECTION_CONSUME)
CONNECTION_GSS_STARTUP =

Negotiating GSSAPI. Available since PostgreSQL-12.

INT2FIX(CONNECTION_GSS_STARTUP)
CONNECTION_CHECK_TARGET =

Checking target server properties. Available since PostgreSQL-13.

INT2FIX(CONNECTION_CHECK_TARGET)
CONNECTION_CHECK_STANDBY =

Checking if server is in standby mode. Available since PostgreSQL-14.

INT2FIX(CONNECTION_CHECK_STANDBY)
PGRES_POLLING_READING =

Async connection is waiting to read

INT2FIX(PGRES_POLLING_READING)
PGRES_POLLING_WRITING =

Async connection is waiting to write

INT2FIX(PGRES_POLLING_WRITING)
PGRES_POLLING_FAILED =

Async connection failed or was reset

INT2FIX(PGRES_POLLING_FAILED)
PGRES_POLLING_OK =

Async connection succeeded

INT2FIX(PGRES_POLLING_OK)
PQTRANS_IDLE =

Transaction is currently idle ( Connection#transaction_status )

INT2FIX(PQTRANS_IDLE)
PQTRANS_ACTIVE =

Transaction is currently active; query has been sent to the server, but not yet completed. ( Connection#transaction_status )

INT2FIX(PQTRANS_ACTIVE)
PQTRANS_INTRANS =

Transaction is currently idle, in a valid transaction block ( Connection#transaction_status )

INT2FIX(PQTRANS_INTRANS)
PQTRANS_INERROR =

Transaction is currently idle, in a failed transaction block ( Connection#transaction_status )

INT2FIX(PQTRANS_INERROR)
PQTRANS_UNKNOWN =

Transaction’s connection is bad ( Connection#transaction_status )

INT2FIX(PQTRANS_UNKNOWN)
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.

INT2FIX(PQERRORS_TERSE)
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).

INT2FIX(PQERRORS_DEFAULT)
PQERRORS_VERBOSE =

Error verbosity level ( Connection#set_error_verbosity ). The VERBOSE mode includes all available fields.

INT2FIX(PQERRORS_VERBOSE)
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.

INT2FIX(PQERRORS_SQLSTATE)
PQSHOW_CONTEXT_NEVER =

See Connection#set_error_context_visibility

INT2FIX(PQSHOW_CONTEXT_NEVER)
PQSHOW_CONTEXT_ERRORS =

See Connection#set_error_context_visibility

INT2FIX(PQSHOW_CONTEXT_ERRORS)
PQSHOW_CONTEXT_ALWAYS =

See Connection#set_error_context_visibility

INT2FIX(PQSHOW_CONTEXT_ALWAYS)
PQPING_OK =

Server is accepting connections.

INT2FIX(PQPING_OK)
PQPING_REJECT =

Server is alive but rejecting connections.

INT2FIX(PQPING_REJECT)
PQPING_NO_RESPONSE =

Could not establish connection.

INT2FIX(PQPING_NO_RESPONSE)
PQPING_NO_ATTEMPT =

Connection not attempted (bad params).

INT2FIX(PQPING_NO_ATTEMPT)
INV_WRITE =

Flag for Connection#lo_creat, Connection#lo_open – open for writing

INT2FIX(INV_WRITE)
INV_READ =

Flag for Connection#lo_creat, Connection#lo_open – open for reading

INT2FIX(INV_READ)
SEEK_SET =

Flag for Connection#lo_lseek – seek from object start

INT2FIX(SEEK_SET)
SEEK_CUR =

Flag for Connection#lo_lseek – seek from current position

INT2FIX(SEEK_CUR)
SEEK_END =

Flag for Connection#lo_lseek – seek from object end

INT2FIX(SEEK_END)
PGRES_EMPTY_QUERY =

Result#result_status constant - The string sent to the server was empty.

INT2FIX(PGRES_EMPTY_QUERY)
PGRES_COMMAND_OK =

Result#result_status constant - Successful completion of a command returning no data.

INT2FIX(PGRES_COMMAND_OK)
PGRES_TUPLES_OK =

Result#result_status constant - Successful completion of a command returning data (such as a SELECT or SHOW).

INT2FIX(PGRES_TUPLES_OK)
PGRES_COPY_OUT =

Result#result_status constant - Copy Out (from server) data transfer started.

INT2FIX(PGRES_COPY_OUT)
PGRES_COPY_IN =

Result#result_status constant - Copy In (to server) data transfer started.

INT2FIX(PGRES_COPY_IN)
PGRES_BAD_RESPONSE =

Result#result_status constant - The server’s response was not understood.

INT2FIX(PGRES_BAD_RESPONSE)
PGRES_NONFATAL_ERROR =

Result#result_status constant - A nonfatal error (a notice or warning) occurred.

INT2FIX(PGRES_NONFATAL_ERROR)
PGRES_FATAL_ERROR =

Result#result_status constant - A fatal error occurred.

INT2FIX(PGRES_FATAL_ERROR)
PGRES_COPY_BOTH =

Result#result_status constant - Copy In/Out data transfer in progress.

INT2FIX(PGRES_COPY_BOTH)
PGRES_SINGLE_TUPLE =

Result#result_status constant - Single tuple from larger resultset.

INT2FIX(PGRES_SINGLE_TUPLE)
PGRES_PIPELINE_SYNC =

:Result represents a synchronization point in pipeline mode, requested by Connection#pipeline_sync.

This status occurs only when pipeline mode has been selected.

Result#result_status constant - The PG
PGRES_PIPELINE_ABORTED =

: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.

Result#result_status constant - The PG
PG_DIAG_SEVERITY =

Result#result_error_field argument constant

The 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.

INT2FIX(PG_DIAG_SEVERITY)
PG_DIAG_SEVERITY_NONLOCALIZED =

Result#result_error_field argument constant

The 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

INT2FIX(PG_DIAG_SEVERITY_NONLOCALIZED)
PG_DIAG_SQLSTATE =

Result#result_error_field argument constant

The SQLSTATE code for the error. The SQLSTATE code identies 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.

INT2FIX(PG_DIAG_SQLSTATE)
PG_DIAG_MESSAGE_PRIMARY =

Result#result_error_field argument constant

The primary human-readable error message (typically one line). Always present.

INT2FIX(PG_DIAG_MESSAGE_PRIMARY)
PG_DIAG_MESSAGE_DETAIL =

an optional secondary error message carrying more detail about the problem. Might run to multiple lines.

Result#result_error_field argument constant

Detail
PG_DIAG_MESSAGE_HINT =

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.

Result#result_error_field argument constant

Hint
PG_DIAG_STATEMENT_POSITION =

Result#result_error_field argument constant

A 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.

INT2FIX(PG_DIAG_STATEMENT_POSITION)
PG_DIAG_INTERNAL_POSITION =

Result#result_error_field argument constant

This 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. The PG_DIAG_INTERNAL_QUERY field will always appear when this field appears.

INT2FIX(PG_DIAG_INTERNAL_POSITION)
PG_DIAG_INTERNAL_QUERY =

Result#result_error_field argument constant

The text of a failed internally-generated command. This could be, for example, a SQL query issued by a PL/pgSQL function.

INT2FIX(PG_DIAG_INTERNAL_QUERY)
PG_DIAG_CONTEXT =

Result#result_error_field argument constant

An 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.

INT2FIX(PG_DIAG_CONTEXT)
PG_DIAG_SOURCE_FILE =

Result#result_error_field argument constant

The file name of the source-code location where the error was reported.

INT2FIX(PG_DIAG_SOURCE_FILE)
PG_DIAG_SOURCE_LINE =

Result#result_error_field argument constant

The line number of the source-code location where the error was reported.

INT2FIX(PG_DIAG_SOURCE_LINE)
PG_DIAG_SOURCE_FUNCTION =

Result#result_error_field argument constant

The name of the source-code function reporting the error.

INT2FIX(PG_DIAG_SOURCE_FUNCTION)
PG_DIAG_SCHEMA_NAME =

Result#result_error_field argument constant

If the error was associated with a specific database object, the name of the schema containing that object, if any.

INT2FIX(PG_DIAG_SCHEMA_NAME)
PG_DIAG_TABLE_NAME =

Result#result_error_field argument constant

If 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.)

INT2FIX(PG_DIAG_TABLE_NAME)
PG_DIAG_COLUMN_NAME =

Result#result_error_field argument constant

If 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.)

INT2FIX(PG_DIAG_COLUMN_NAME)
PG_DIAG_DATATYPE_NAME =

Result#result_error_field argument constant

If 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.)

INT2FIX(PG_DIAG_DATATYPE_NAME)
PG_DIAG_CONSTRAINT_NAME =

Result#result_error_field argument constant

If 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.)

INT2FIX(PG_DIAG_CONSTRAINT_NAME)
PQ_PIPELINE_ON =

Connection#pipeline_status constant

The libpq connection is in pipeline mode.

INT2FIX(PQ_PIPELINE_ON)
PQ_PIPELINE_OFF =

Connection#pipeline_status constant

The libpq connection is not in pipeline mode.

INT2FIX(PQ_PIPELINE_OFF)
PQ_PIPELINE_ABORTED =

Connection#pipeline_status constant

The 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.

INT2FIX(PQ_PIPELINE_ABORTED)
INVALID_OID =

Invalid OID constant

INT2FIX(InvalidOid)
InvalidOid =
INT2FIX(InvalidOid)
DEF_PGPORT =

PostgreSQL compiled in default port

INT2FIX(DEF_PGPORT)