PostgreSQL connection lifecycle, I/O, simple-query protocol, statement cache and LISTEN/NOTIFY support.
This module is a thin re-export hub. The actual implementation lives in the pg_connection/ subdirectory:
- pg_connection/types — PgConnection, ConnConfig, the tracing data types, the PgTracer hook record, and the tracing helper templates (withConnTracing, withTracing).
- pg_connection/dsn — DSN parsing (URI and libpq keyword=value formats) plus initConnConfig and parseDsn.
- pg_connection/buffer_io — recv/send buffering (fillRecvBuf, nextMessage, recvMessage, sendMsg), TCP keepalive, closeTransport, notification/notice dispatch, isConnected / socketHasFin, and the getHosts host helper.
- pg_connection/ssl — SSL negotiation (negotiateSSL) for chronos+BearSSL and asyncdispatch+OpenSSL.
- pg_connection/cache — client-side prepared-statement LRU.
- pg_connection/simple_query — simple-query / simple-exec / ping, cancel / invalidateOnTimeout, checkSessionAttrs, quoteIdentifier, QueryResult helpers.
- pg_connection/lifecycle — connect / connectToHost / close, orderedHosts (load-balanced host ordering) and the SCRAM/require_auth helpers.
- pg_connection/notify — LISTEN/NOTIFY pump, waitNotification, reconnectInPlace.
- pg_connection/type_lookup — lookupTypeOids generic helper to resolve type names to OIDs via to_regtype (extension types like hstore, citext, etc.).
Every public symbol previously defined in this file is re-exported from here, so existing import async_postgres/pg_connection (or the bundled import pkg/async_postgres) call sites keep working without changes. Test files that previously used import pg_connection {.all.} to reach private helpers must now import the specific submodule directly, e.g. import pg_connection/buffer_io {.all.}.
Exports
-
SqlStateNotNullViolation, ErrorField, isQueryCanceled, PgError, errorField, PgStateError, SqlStateSyntaxError, SqlStateUniqueViolation, SqlStateForeignKeyViolation, PgNotifyOverflowError, schemaName, SqlStateQueryCanceled, isForeignKeyViolation, SqlStateSerializationFailure, isIntegrityConstraintViolation, tableName, SqlStateDeadlockDetected, PgTimeoutError, isCheckViolation, isExclusionViolation, where, SqlStateCheckViolation, constraintName, position, PgConnectionError, isSerializationFailure, isUniqueViolation, isDeadlockDetected, PgQueryError, PgTypeError, PgProtocolError, isNotNullViolation, dataTypeName, SqlStateExclusionViolation, internalQuery, PgPoolError, SqlStateUndefinedTable, ProtocolError, PgNoRowsError, PgNullError, columnName, internalPosition, PgListenError, getErrorField, TargetSessionAttrs, TransportCloseStage, CopyInCallback, TracePoolReleaseEndData, NoticeCallback, TraceCopyStartData, AuthMethod, TraceLeakedSessionLocksData, withConnTracing, HostEntry, newPgQueryError, initReplLsnTracking, TracePrepareEndData, TraceQueryStartData, replConfirmedFlushLsn, TraceQueryEndData, PgConnState, TracePoolAcquireEndData, CleanupSkipReason, replMaxReceivedLsn, CachedStmt, CopyInInfo, QueryResult, TCP_KEEPCNT, SslMode, LoadBalanceHosts, TracePipelineEndData, ConnConfig, CleanupKind, CopyOutInfo, CopyOutCallback, confirmReplFlushed, TraceTransportCloseErrorData, TraceAdvisoryUnlockFailedData, TCP_KEEPINTVL, effectiveMaxMessageSize, fireDeprecatedAuth, TraceDeprecatedAuthData, TraceCopyDirection, TracePoolAcquireStartData, PgConnection, withTracing, TraceConnectStartData, dialAddr, TraceCopyEndData, TracePoolReleaseStartData, TracePipelineStartData, updateReplMaxReceivedLsn, ChannelBindingMode, TracePrepareStartData, NotifyCallback, TraceContext, displayHost, TraceCleanupSkippedData, TracePoolDoubleReleaseData, TCP_KEEPIDLE, PgPoolOwner, RecvBufSize, CopyResult, Notice, TraceInsecureAuthData, Notification, fireCleanupSkipped, PgTracer, RowCallback, TraceConnectEndData, TracePoolCloseErrorData, fireAdvisoryUnlockFailed, fireInsecureAuth, applyParam, parseRequireAuth, parsePort, parseUriDsn, parseTargetSessionAttrs, parseChannelBindingMode, parseSslMode, parseAuthMethod, parseDsn, initConnConfig, parseLoadBalanceHosts, parseKeyValueDsn, sendBufMsg, cancel, RecvWatch, take, pending, dispatchNotification, sendRawData, unixSocketPath, ready, sendRawBytes, dispatchNotice, rearm, compactRecvBuf, nextMessage, configureTcpNoDelay, sendMsg, getHosts, configureKeepalive, MSG_DONTWAIT, socketHasFin, isConnected, makeCopyInCallback, startRecvWatch, makeCopyOutCallback, isUnixSocket, closeTransport, recvMessage, TCP_NODELAY, socketHasPendingData, fillRecvBuf, negotiateSSL, nextStmtName, lookupStmtCache, clearStmtCache, evictStmtCache, flushPendingStmtCloses, removeStmtCache, flushPendingStmtCloses, addStmtCache, len, simpleQueryImpl, ping, rows, items, quoteIdentifier, cancelNoWait, columnIndex, simpleExec, checkReady, simpleQuery, invalidateOnTimeout, cancel, checkSessionAttrs, bytesToString, simpleExecImpl, enforceAuthAllowed, connect, filterSaslByRequireAuth, connect, selectScramMechanism, orderedHosts, close, connectToHost, waitNotification, listenPump, stopListening, onListenError, onNotify, listen, reconnectInPlace, startListening, unlisten, lookupTypeOids, TypeOidInfo