github gajus/slonik slonik@49.14.0

latest releases: @slonik/types@49.14.0, slonik-interceptor-query-logging@49.14.0
one hour ago

Minor Changes

  • 8eb25b2 Thanks @gajus! - fix: the type of QueryResult.command (and of DriverCommand) now includes every command that Postgres reports, e.g. MERGE, SET and CREATE (for CREATE TABLE), not only COPY, DELETE, INSERT, SELECT and UPDATE. The command is null if the query has no statement (e.g. it consists only of a comment), which was already the case at runtime. Code that handles the commands exhaustively, or that uses the command without checking for null, may need to be updated.

  • #832 6090a3c Thanks @sgtoj! - add queueTimeout configuration, which limits how long a query waits for a connection when the pool is full. Once the timeout elapses, the query fails with QueueTimeoutError, which extends ConnectionError. The query is not retried: connectionRetryLimit applies to establishing a connection. The timeout is disabled by default, i.e. a query waits until a connection becomes available.

  • 625c3e7 Thanks @gajus! - fix: the types no longer accept arrays and buffers as values interpolated in a query, or as members of sql.join, sql.list, sql.and and sql.or. They passed type-checking, but always threw at runtime (e.g. "Unexpected value expression."). Bind arrays using sql.array and buffers using sql.binary. Code that interpolates a value typed as PrimitiveValueExpression (which includes arrays and buffers) no longer compiles; type the value as ValueExpression instead.

Patch Changes

  • 777d254 Thanks @gajus! - fix: the connections that the pool keeps open for minPoolSize are no longer closed and replaced after idleTimeout. Besides the pool, the driver closed every connection idleTimeout after it was released, regardless of minPoolSize, so the pool kept opening new connections to replace them. Now only the pool closes idle connections, and it keeps minPoolSize connections open.

  • #832 6090a3c Thanks @sgtoj! - fix: the pool no longer exceeds maxPoolSize when it replaces a destroyed connection to keep minPoolSize connections while another connection is being established.

  • #832 6090a3c Thanks @sgtoj! - fix: queries that wait for a connection no longer wait forever when the connections that the pool is establishing fail (e.g. because the database refuses connections) and the pool has no other connections. They fail with the connection error, which is retried according to connectionRetryLimit.

  • 4edcfd6 Thanks @gajus! - fix: rowCount is the number of returned rows for statements that do not report a row count (e.g. SHOW and EXPLAIN), instead of 0. This also stops slonik-interceptor-query-cache from treating the results of such statements as empty (discardEmpty).

  • Updated dependencies [8eb25b2, 777d254, 6090a3c, 625c3e7]:

    • @slonik/driver@49.14.0
    • @slonik/errors@49.14.0
    • @slonik/sql-tag@49.14.0
    • @slonik/pg-driver@49.14.0
    • @slonik/utilities@49.14.0

Don't miss a new slonik release

NewReleases is sending notifications on new releases.