Minor Changes
-
#826
4f74b91Thanks @gajus! - fix:UnexpectedForeignConnectionErroris raised only while the transaction is open. Previously, async work that was started inside of a transaction (e.g. a deferred side effect, or acommit/rollbackevent listener) raised the error for any query that it ran on another connection, even after the transaction had ended. AddrunOutsideTransaction(routine)to run queries on other connections while a transaction is open, e.g.await runOutsideTransaction(() => pool.query(auditLogQuery)). -
#826
4f74b91Thanks @gajus! - addforeignConnectionsconfiguration ("reject"(default) or"allow"), which replacesdangerouslyAllowForeignConnections.dangerouslyAllowForeignConnections: truekeeps working as a deprecated alias offoreignConnections: "allow";foreignConnectionstakes precedence when both are provided. -
#829
bed6b20Thanks @gajus! - fix:oneFirstthrowsDataIntegrityError(instead ofUnexpectedStateError) when the query returns multiple columns, likemaybeOneFirst,anyFirstandmanyFirst. -
#829
bed6b20Thanks @gajus! - remove thevaluesparameter from the types of the query methods (e.g.pool.query(query, values)). The parameter was accepted, but ignored; values are bound using thesqltag. -
#829
bed6b20Thanks @gajus! - fix: a query that fails withNotFoundError,DataIntegrityErrororSchemaValidationError(e.g.pool.one()that finds no rows) no longer destroys its connection; the connection is returned to the pool. This applies to queries and transactions on the pool. Connections used bypool.connect()are still destroyed when the routine fails. -
#829
bed6b20Thanks @gajus! - fix:stream()rejects with the error of atransformRowortransformRowAsyncinterceptor (e.g. aSchemaValidationErrorof a result parser). Previously, the error was an unhandled rejection,stream()never settled, and the connection was never released.stream()also waits for the promise returned by the stream handler (e.g. anasyncfunction that usesfor await). When the consumer of a stream fails, the driver closes the cursor, so that the connection can be used again (e.g. to roll back the transaction). -
#829
bed6b20Thanks @gajus! - add theretryLimitoption totransaction(), e.g.pool.transaction(handler, { retryLimit: 3 }). Passing the retry limit as the second argument (pool.transaction(handler, 3)) is deprecated. Also fixespool.transaction()dropping the retry limit when abeforePoolConnectioninterceptor returns another pool: the options are now passed to that pool.