What the user may pass as the PostgreSQL connection option:
an already-constructed pg.Pool instance (we use it as-is and do NOT close
it on close() — the caller owns its lifecycle), or
a node-postgres pool config / connection string (we lazily require('pg')
and construct the pool ourselves, owning its lifecycle).
The optional schema (the namespace for all queues) is only read from the
config-object form, because that is the only case where we build the pool
ourselves and can pin each connection's search_path to it. A bare
connection string or an already-constructed pg.Pool always uses
DEFAULT_SCHEMA — a raw pool cannot carry a schema, and we cannot set
the search_path on a pool we did not create. To select a different schema,
pass a config object (a connection string can be wrapped as
{ connectionString, schema }; a pre-built pool must be configured with the
desired search_path by the caller).
What the user may pass as the PostgreSQL
connectionoption:pg.Poolinstance (we use it as-is and do NOT close it onclose()— the caller owns its lifecycle), orrequire('pg')and construct the pool ourselves, owning its lifecycle).The optional
schema(the namespace for all queues) is only read from the config-object form, because that is the only case where we build the pool ourselves and can pin each connection'ssearch_pathto it. A bare connection string or an already-constructedpg.Poolalways uses DEFAULT_SCHEMA — a raw pool cannot carry aschema, and we cannot set thesearch_pathon a pool we did not create. To select a different schema, pass a config object (a connection string can be wrapped as{ connectionString, schema }; a pre-built pool must be configured with the desiredsearch_pathby the caller).