-
Notifications
You must be signed in to change notification settings - Fork 165
Description
Summary
Using PgDog in front of PostgreSQL for a Bun/Drizzle dashboard app in transaction mode appears to corrupt extended-protocol result handling intermittently and sometimes on very simple SELECT queries.
We are seeing repeated client-side decode failures plus a server-side protocol mismatch symptom:
ERR_POSTGRES_UNSUPPORTED_INTEGER_SIZEFailed to read dataTypeError: undefined is not an object (evaluating 'a.toISOString')bind message has 2 result formats but query has 17 columns
This is happening in staging while routing reads through PgDog to replicas and writes to primary.
Environment
- PgDog image:
ghcr.io/pgdogdev/pgdog:0.1.30 - Helm chart revision:
v0.46 - Kubernetes deployment, 2 PgDog replicas
- Pooler mode:
transaction - Prepared statements:
extended_anonymous - Auth:
passthrough_auth = "enabled_plain" - TLS verify upstream:
prefer - Client: Bun
1.3.11 - ORM: Drizzle
bun-sql - App: Next.js dashboard server components / server actions
Relevant PgDog config:
[general]
pooler_mode = "transaction"
read_write_strategy = "conservative"
read_write_split = "exclude_primary"
prepared_statements = "extended_anonymous"
passthrough_auth = "enabled_plain"
tls_verify = "prefer"
[[databases]]
name = "ndr"
host = "ha-postgres-primary"
port = 5432
role = "primary"
[[databases]]
name = "ndr"
host = "ha-postgres-replicas"
port = 5432
role = "replica"Symptoms
The failure shows up when listing datasets and then clicking a dataset row to navigate into the dataset page.
The affected queries can be extremely simple, for example:
select "id", "name"
from "ndr"."datasets"
where "ndr"."datasets"."slug" = $1and also:
select "id", "slug", "name", "owner", "description", "retention_days", "pii_classification", "default_storage_area", "created_at", "updated_at"
from "ndr"."datasets"
where "ndr"."datasets"."slug" = $1and:
select "ndr"."pipelines"."id", "ndr"."pipelines"."name", "ndr"."pipelines"."dataset_id", "ndr"."datasets"."slug", "ndr"."pipelines"."description", "ndr"."pipelines"."owner", "ndr"."pipelines"."created_at", "ndr"."pipelines"."updated_at", "ndr"."pipelines"."config", "ndr"."pipelines"."current_revision_id", "ndr"."pipelines"."allow_duplicates", "ndr"."pipelines"."active", "ndr"."pipelines"."concurrency_limit", "ndr"."pipelines"."default_job_options", "ndr"."pipelines"."last_run_at", "ndr"."pipelines"."last_status", "ndr"."pipelines"."deleted_at"
from "ndr"."pipelines"
inner join "ndr"."datasets" on "ndr"."pipelines"."dataset_id" = "ndr"."datasets"."id"
where ("ndr"."datasets"."slug" = $1 and "ndr"."pipelines"."deleted_at" is null)
order by "ndr"."pipelines"."created_at" descWe also saw this logged from the app side:
Failed query: select "id", "dataset_id" from "ndr"."pipelines" where "ndr"."pipelines"."deleted_at" is null
params:
: bind message has 2 result formats but query has 17 columns
And many repeated errors like:
PostgresError: Failed to read data
code: 'ERR_POSTGRES_UNSUPPORTED_INTEGER_SIZE'
Notes
- This does not look like a SQL parser / read-write routing issue. The same failures happen on very simple
SELECTs. - PgDog logs do not show parser failures; mostly normal connect/disconnect with occasional
Connection reset by peer. - We previously saw intermittent
TypeError: undefined is not an object (evaluating 'a.toISOString'), which may be a downstream effect of corrupted / mismatched result decoding. - The client uses Bun's built-in Postgres driver through Drizzle. We are not using node-postgres.
Question
Does this look like another extended protocol / prepared statement / result format bug in PgDog transaction mode?
In particular, does extended_anonymous have known incompatibilities with Bun's driver when result format metadata changes across binds or pooled backend connections?