Skip to content

Releases: steadybrew/postgresjs

4.8.0

Choose a tag to compare

@okomarov okomarov released this 04 Nov 16:27

@steadybrew/postgresjs@4.8.0 lets APM and OpenTelemetry tools trace queries, connections, pool waits and transactions through diagnostics_channel, and promotes 4.8.0-rc1 unchanged. No breaking changes.

npm install @steadybrew/postgresjs@4.8.0
  • Trace queries, connections, pool waits and transactions with diagnostics_channel.
  • A custom serializer that throws a frozen error, a Symbol or a frozen object fails only its query instead of stalling the connection.

Known limits: Postgres.js 4.0.0 uses the same channel names with different fields, so a subscriber written for it needs changes to read these; see Tracing channels.

See the changelog for details and upstream references.

Validation: CI passed on Node 22/24/26 × PostgreSQL 15–18, Deno and workerd (run); Workers CPU per connection no higher than 4.7.0 (run).

4.8.0-rc1

4.8.0-rc1 Pre-release
Pre-release

Choose a tag to compare

@okomarov okomarov released this 30 Oct 13:35

@steadybrew/postgresjs@4.8.0-rc1 lets APM and OpenTelemetry tools trace queries, connections, pool waits and transactions through diagnostics_channel, without patching the driver. No breaking changes.

npm install @steadybrew/postgresjs@4.8.0-rc1
  • Trace queries, connections, pool waits and transactions with diagnostics_channel.
  • A custom serializer that throws a frozen error, a Symbol or a frozen object fails only its query instead of stalling the connection.

See the changelog for details and upstream references.

Feedback wanted before 4.8.0: spans from a Sentry, Datadog or OpenTelemetry subscriber on the new channels, and any change in how queries settle or fail, since the request lifecycle underneath was restructured to give tracing one place to hook.

Validation: CI passed on Node 22/24/26 × PostgreSQL 15–18, Deno and workerd (run); Workers CPU per connection no higher than 4.7.0 (run).

4.7.0

Choose a tag to compare

@okomarov okomarov released this 24 Oct 00:39

@steadybrew/postgresjs@4.7.0 stops transactions from committing half their work, and gives a handle used after release() or after its transaction ended its own error code. Nothing breaks unless your code checks for CONNECTION_ENDED to catch those handles.

npm install @steadybrew/postgresjs@4.7.0
  • A reserved connection used after release() rejects with CONNECTION_RELEASED, and a transaction handle used after its transaction ended, or while its COMMIT runs, with TRANSACTION_ENDED. CONNECTION_ENDED now means only that sql.end() was called.
  • A transaction no longer commits half its work when a statement in it fails before it is sent, such as one with an undefined value.
  • A transaction no longer commits half its work when you cancel one of its statements with query.cancel() before it is sent.

The switching tool, @steadybrew/postgresjs-migrate 0.2.0, gives advice that matches these codes.

See the changelog for details and upstream references.

Validation: CI passed on Node 22/24/26 × PostgreSQL 15–18, Deno and workerd (run); Workers CPU per connection no higher than 4.6.0 (run).

4.6.0

Choose a tag to compare

@okomarov okomarov released this 21 Oct 19:31

@steadybrew/postgresjs@4.6.0 makes new connections cheaper and fixes COPY, subscribe() and TLS errors on Cloudflare Workers. It promotes 4.6.0-rc1 unchanged. No breaking changes.

npm install @steadybrew/postgresjs@4.6.0
  • Opening a connection costs less CPU with SCRAM-SHA-256 passwords.
  • On Cloudflare Workers, COPY ... TO STDOUT streams and sql.subscribe() work.
  • On Cloudflare Workers, a server whose certificate Workers don't trust, such as Supabase's, fails at once with TLS_CLOSED.
  • On Cloudflare Workers, ssl: 'prefer' connects without TLS when the server doesn't offer it.
  • On Deno, sslnegotiation: 'direct' connects to PostgreSQL 18.

See the changelog for details and upstream references.

Validation: CI passed on Node 22/24/26 × PostgreSQL 15–18, Deno and workerd (run); Workers CPU per connection no higher than 4.5.1 at median, p95 or p99 (gate, 150-round A/B). A day in production on Node.js and Deno matched 4.5.0 with no connection errors.

4.6.0-rc1

4.6.0-rc1 Pre-release
Pre-release

Choose a tag to compare

@okomarov okomarov released this 20 Oct 17:58

@steadybrew/postgresjs@4.6.0-rc1 makes new connections cheaper and fixes COPY, subscribe() and TLS errors on Cloudflare Workers. No breaking changes.

npm install @steadybrew/postgresjs@4.6.0-rc1
  • Opening a connection costs less CPU with SCRAM-SHA-256 passwords.
  • On Cloudflare Workers, COPY ... TO STDOUT streams and sql.subscribe() work.
  • On Cloudflare Workers, a server whose certificate Workers don't trust, such as Supabase's, fails at once with TLS_CLOSED.
  • On Cloudflare Workers, ssl: 'prefer' connects without TLS when the server doesn't offer it.
  • On Deno, sslnegotiation: 'direct' connects to PostgreSQL 18.

See the changelog for details and upstream references.

Feedback wanted before 4.6.0: connection errors or slower logins with SCRAM-SHA-256 (Node.js, Deno and Workers), and anything on Cloudflare Workers.

Validation: CI passed on Node 22/24/26 × PostgreSQL 15–18, Deno and workerd (run); Workers CPU per connection no higher than 4.5.1 (run).

4.5.1

Choose a tag to compare

@okomarov okomarov released this 18 Oct 14:12

@steadybrew/postgresjs@4.5.1 updates the README and API reference on npm. The code is the same as 4.5.0, so nothing breaks.

npm install @steadybrew/postgresjs@4.5.1
  • The README now starts with switching from Postgres.js.
  • The API reference is in docs/api.md and ships in the package.
  • The Sentry tracing preload and the other upgrade steps are in the migration guide.

See the changelog for details.

Validation: CI passed on Node 22/24/26 × PostgreSQL 15–18, Deno and workerd (run).

4.5.0

Choose a tag to compare

@okomarov okomarov released this 17 Oct 13:52

@steadybrew/postgresjs@4.5.0 lets queries with values take one round trip instead of two, and fixes wrong rows after a failed query, hangs after COPY TO and a crash when cancelling a query you don't await. No breaking changes; two behavior changes correct settings that did the opposite of what they say.

npm install @steadybrew/postgresjs@4.5.0
  • Queries with values can take one round trip instead of two, with parameter_types: 'client'. In production on one app behind the Supabase pooler, the median query went from 5.3 to 3.1 ms.
  • parameter_types: 'warn' reports the queries 'client' would send differently.
  • Node.js 22 is supported.
  • await using sql = postgres() ends the pool, and using reserved = await sql.reserve() releases the connection, when they go out of scope.
  • PGPREPARE=false, PGFETCH_TYPES=false, PGDEBUG=false and PGSSL=disable (or false) now turn those options off.
  • target_session_attrs: 'read-write' no longer connects to a hot standby, and 'read-only' now accepts one.
  • A query no longer gets empty slots at the start of its result after the previous query on the connection failed or was cancelled partway through its rows.
  • Queries no longer hang after a COPY ... TO STDOUT whose reader fell behind.
  • Cancelling a query you don't await no longer crashes the process.
  • dd-trace records Postgres.js spans again when the fork is installed as postgres.
  • Code that assigns err.stack on a query error no longer throws on Node 22 and newer.
  • TypeScript accepts the sslnegotiation and socket options.
  • new PostgresError('message') sets the message, like Error.
  • Column names ending with an underscore no longer throw under the camel and pascal transforms.
  • A cancelled query no longer stays pending forever when a schema change made the server reject it before it started.

See the changelog for details and upstream references.

Validation: CI passed on Node 22/24/26 × PostgreSQL 15–18, Deno and workerd (run). Every upstream report and pull request listed as fixed has a test that fails on Postgres.js 3.4.9 for the reported reason and passes here.

4.5.0-rc1

4.5.0-rc1 Pre-release
Pre-release

Choose a tag to compare

@okomarov okomarov released this 15 Oct 13:53

@steadybrew/postgresjs@4.5.0-rc1 sends queries with values in one round trip instead of two, and adds Node.js 22 support and await using. No breaking changes.

npm install @steadybrew/postgresjs@4.5.0-rc1
  • Queries with values can take one round trip instead of two, with parameter_types: 'client'.
  • parameter_types: 'warn' reports the queries 'client' would send differently.
  • Queries whose values are all booleans, bigints, Dates, Buffers or sql.typed() values with a type take one round trip in every mode.
  • dd-trace records Postgres.js spans again when the fork is installed as postgres.
  • Code that assigns err.stack on a query error no longer throws on Node 22 and newer.
  • Node.js 22 is supported.
  • await using sql = postgres() ends the pool, and using reserved = await sql.reserve() releases the connection, when they go out of scope.
  • The types need @types/node 22 or newer, or skipLibCheck.

See the changelog for details and upstream references.

Feedback wanted before 4.5.0: what parameter_types: 'warn' reports on a real workload that the README doesn't explain.

Validation: CI passed on Node 22/24/26 × PostgreSQL 15–18, Deno and workerd (run).

4.4.1

Choose a tag to compare

@okomarov okomarov released this 12 Oct 12:05

@steadybrew/postgresjs@4.4.1 fixes a hang that 4.4.0 introduced for code that queries while its own COPY is still open, and a delay of up to about 10 seconds in sql.subscribe() on PostgreSQL 16 and later. No breaking changes.

npm install @steadybrew/postgresjs@4.4.1
  • A query awaited while your own COPY is still open fails with COPY_IN_PROGRESS instead of hanging forever.
  • sql.subscribe() no longer delivers a change up to about 10 seconds late on PostgreSQL 16 and later.

See the changelog for details.

Validation: CI passed on Node 24/26 × PostgreSQL 15–18, Deno and workerd (run).

4.4.0

Choose a tag to compare

@okomarov okomarov released this 11 Oct 23:12

@steadybrew/postgresjs@4.4.0 is a correctness release: a statement no longer returns another query's rows after a column type changes, sql.begin() no longer reports a commit that was rolled back, and errors thrown in your callbacks and transforms no longer break connections or subscriptions. No API is removed, but three behaviours change; see below.

npm install @steadybrew/postgresjs@4.4.0

Behaviour changes:

  • An error thrown in your callbacks is now an uncaught exception, which ends the process under Node's default handling.
  • Queries no longer fail with COPY_IN_PROGRESS while another part of your program runs a COPY; they run on another connection or wait for one.
  • An error thrown by a transform on a sql.subscribe() change goes to onerror, and only that change is skipped.

Fixes:

  • sql.begin() rejects when the server rolled the transaction back, instead of resolving as if it committed.
  • After a column type changes while your app runs, a statement no longer returns another query's rows.
  • A query sent while copy ... from stdin is starting no longer drops the connection and the copied rows.
  • A transaction running statements concurrently after a column type change no longer leaves its connection broken.
  • An error thrown in your callback no longer fails an unrelated query or breaks new connections.
  • onnotice: false silences notices.
  • sql.subscribe() no longer loses changes after a transform throws.
  • sql.end() no longer hangs or crashes the process while sql.subscribe() is reconnecting.
  • sql.subscribe() on a table with a one-character name receives its changes.

See the changelog for details and upstream references.

Validation: CI passed on Node 24/26 × PostgreSQL 15–18, Deno and workerd (run).