ReadonlypoolReadonlyschemaThe PostgreSQL schema (namespace) this connection's queues live in. It is
applied to every pooled connection's search_path, so the .sql command
files (and the operation functions) reference unqualified names and stay
portable — the schema selects the namespace, never the SQL itself.
Whether TCP keepalive is enabled on the dedicated LISTEN connection, so a
silently dropped connection is detected (and the client rebuilt) instead of
lingering unnoticed. Consulted by the backend when deciding how long a
worker may block.
Truthy once PostgresConnection.close has begun.
Closes the connection: releases the LISTEN client and (if owned) ends the
pool. Safe to call multiple times.
Forcibly tears down the connection. For PostgreSQL there is no distinct "disconnect without waiting" semantics beyond closing, so this delegates to PostgresConnection.close.
Returns the dedicated client used for LISTEN/NOTIFY, establishing it on
first use.
When this connection owns the pool we use a standalone pg.Client (its
own dedicated TCP connection) so the long-lived LISTEN never consumes a
pool slot — this is what lets the query pool run at max: 1 without
deadlocking. When the user supplied their own pg.Pool we check a client
out of it (so such pools should be sized >= 2).
Sets the application_name of the dedicated LISTEN connection — the
PostgreSQL analogue of Redis CLIENT SETNAME — and remembers it so it is
re-applied to any client rebuilt after a drop.
Resolves once the pool is reachable and the schema is compatible.
Idempotent and memoized. By default this only reads the migration ledger.
When migrate: true was configured, migrations run on one checked-out
client so their advisory lock and transaction share a session.
Owns the PostgreSQL connection resources for a single backend:
pg.Poolfor regular, short-lived queries, andLISTENclient used by the blocking "wait for job" primitive (lazily established).Lifecycle mirrors RedisConnection: it is an EventEmitter that surfaces normalized
'ready' | 'error' | 'close'events and exposes PostgresConnection.waitUntilReady and PostgresConnection.close.