Slonik Versions Save

A Node.js PostgreSQL client with runtime and build time type safety, and composable SQL.

v41.1.0

3 weeks ago

v41.0.1

3 weeks ago

The fix is in this commit: https://github.com/gajus/slonik/commit/0e83bc14817936eb409bd36d099a4615d69914fb

It shows how simultaneously releasing and ending the pool could have resulted in termination sequence proceeding without waiting for release sequence to complete. The symptom of this would have been an error that complains about an attempt to use a terminated backend.

Shoutout to @mikeroelens for going above and beyond to chase down the root of the issue and suggest a fix and context that led to replicating the mysterious behavior. 🥳

v41.0.0

4 weeks ago

New Slonik behavior means that you can no longer accidentally run a non-transaction query inside of a transaction.

If you receive an error UnexpectedForeignConnectionError, then you are trying to execute a query using a connection that is not associated with the transaction. This error is thrown to prevent accidental unsafe transaction handling, e.g.

connection.transaction(async (transactionConnection) => {
  await connection.query(sql.typeAlias('void')`INSERT INTO foo (bar) VALUES ('baz')`);
});

In this example, the query is executed using the connection that is not associated with the transaction. This is unsafe because the query is not part of the transaction and will not be rolled back if the transaction is aborted.

This behavior is achieved using AsyncLocalContext.

v40.2.6

4 weeks ago

v40.2.5

4 weeks ago

v40.2.4

4 weeks ago

v40.2.3

4 weeks ago

v40.2.2

1 month ago

v40.2.1

1 month ago

v40.2.0

1 month ago