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.
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).
Resolves once the pool is reachable and the schema is up to date.
Idempotent and memoized: the migration runs exactly once per connection, on a single dedicated client checked out of the pool (so the migration's advisory lock and transaction share one session — see runMigrations).
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, exposes PostgresConnection.waitUntilReady (which also runs the schema migrations exactly once, on a dedicated checked-out client) and PostgresConnection.close.