Skip to content

docs: warn about postgres.js pipelining on Supavisor transaction mode - #50712

Merged
mentels merged 12 commits into
masterfrom
docs/postgres-js-pipelining-warning
Sep 25, 2026
Merged

mentels merged 12 commits into
masterfrom
docs/postgres-js-pipelining-warning

Conversation

@mentels

@mentels mentels commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Re-does #50082 against the redesigned connecting-to-postgres.mdx (see Slack discussion).

What changed vs. #50082:

  • connecting-to-postgres.mdx: the pipelining caution now lives in the new Transaction mode limitations section (the old "Pooler transaction mode" prose it was in got redesigned), and is a short redirect to the Postgres.js guide rather than a full explanation.
  • postgres-js.mdx: keeps the full warning, the { prepare: false } workaround, and now explains why pipelining can't just be turned off (max_pipeline: 0 breaks sql.begin(), tracked in BEGIN can reach PostgreSQL without reserving the transaction connection porsager/postgres#1189), plus a "contact support" prompt for anyone still stuck, and a note that Supavisor v2.10 will add native pipelining support.
  • Drops the standalone troubleshooting page from docs: warn about postgres.js pipelining on Supavisor transaction mode #50082 — the team wasn't confident enough yet to officially point everyone at the postgres.js patch, so support is the escalation path for now instead.
  • Re-adds the Rule003Spelling.toml allow-list entry for "pipelining" (not present on master).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Clarified that query pipelining is unsupported in transaction mode and may cause hangs or mismatched results.
    • Documented Postgres.js pipeline behavior, recommended workarounds, and planned native support in a future Supavisor release.
    • Updated the Postgres.js connection example to disable prepared statements for improved compatibility.
    • Added a support contact link for assistance with transaction-mode pipeline issues.

Preview

Re-does #50082 against the redesigned connecting-to-postgres page.
Adds a short caution in the new "Transaction mode limitations"
section that redirects postgres.js users to the postgres-js guide,
which keeps the full warning, the prepare: false workaround, and a
"contact support" prompt for anyone still stuck. Drops the standalone
troubleshooting page per team discussion, since we're not confident
enough yet to officially recommend the porsager/postgres patch.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@mentels
mentels requested a review from a team as a code owner September 22, 2026 09:18
@supabase

supabase Bot commented Sep 22, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@vercel

vercel Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
design-system Ready Ready Preview Sep 24, 2026 9:16am UTC
docs Ready Ready Preview, v0 Sep 24, 2026 9:16am UTC
kb Ready Ready Preview Sep 24, 2026 9:16am UTC
studio-self-hosted Ready Ready Preview Sep 24, 2026 9:16am UTC
studio-staging Ready Ready Preview Sep 24, 2026 9:16am UTC
ui-library Ready Ready Preview Sep 24, 2026 9:16am UTC
zone-www-dot-com Ready Ready Preview, v0 Sep 24, 2026 9:16am UTC
1 Skipped Deployment
Project Deployment Actions Updated
studio Ignored Ignored Sep 24, 2026 9:16am UTC

Request Review

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Sep 22, 2026
@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: supabase/supabase/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 3767c9b4-979c-4b59-8403-0d18fd81d1c9

📥 Commits

Reviewing files that changed from the base of the PR and between 7eb1d07 and 88a5e3b.

📒 Files selected for processing (1)
  • apps/docs/content/guides/database/connecting-to-postgres.mdx
💤 Files with no reviewable changes (1)
  • apps/docs/content/guides/database/connecting-to-postgres.mdx

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The database guides now document query pipelining limitations in transaction mode, Postgres.js workarounds, and the updated connection example. The spelling configuration allows pipeline-related terms.

Changes

Postgres pipelining documentation

Layer / File(s) Summary
Transaction-mode limitation guidance
apps/docs/content/guides/database/connecting-to-postgres.mdx
Documents that transaction mode does not support query pipelining and can cause hangs or mismatched rows.
Postgres.js setup and workarounds
apps/docs/content/guides/database/postgres-js.mdx, supa-mdx-lint/Rule003Spelling.toml
Documents Postgres.js pipelining workarounds, passes { prepare: false } to postgres(), and allows pipeline-related terms in spelling checks.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

Suggested reviewers: czenko

Merge Risk: ⚪ Minimal · up to 88a5e

This documentation-only change clarifies PostgreSQL pipelining limitations and workarounds without changing product behavior, so it is ready to merge.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the changes and includes preview links, but it does not use the required Problem and Solution sections or provide the required numbered review instructions and checklist. Restructure the description using the template. Add Problem and Solution sections, provide numbered review instructions, and include the required checklist items.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: adding documentation warnings for postgres.js pipelining with Supavisor transaction mode.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

mentels and others added 6 commits September 22, 2026 11:24
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Matches the other Transaction mode limitations items (Prepared
statements, Cursors, Session-level state), which are plain bold-led
paragraphs rather than admonitions.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

@czenko czenko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before merging, I recommend passing this through docs/CONTRIBUTING and our WORD-LIST or using our /edit-the-docs skill.

Comment on lines +41 to +49
<Admonition type="caution">

`postgres.js` pipelines queries by default. Combined with [the shared pooler transaction mode](/docs/guides/database/connecting-to-postgres#pooler-transaction-mode) , this can hang queries or return mismatched rows. `postgres.js` has no working option to turn pipelining off directly: `max_pipeline: 0` breaks `sql.begin()` transactions instead, a known upstream [bug](https://github.com/porsager/postgres/issues/1189).

An upcoming Supavisor release will add native pipelining support in the transaction mode.

If you need more guidance on the pipelining with `postgres.js`, [contact support](/dashboard/support/new).

</Admonition>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want to double check that this ran through our docs CONTRIBUTING guide and WORD_LIST. We also have a skill called /edit-the-docs for this.

There are a few style issues:

  • A small grammatical typo: there's a space before the comma ` ,'.
  • 'An upcoming Supabisor release...' goes against Timeless Documentation. This is at risk of going stale.
  • 'If you need more guidance...' can be. 'For more about X, see Y'
  • Inconsistent linking convention. A new style guide will merge shortly that will include more linking conventions. Here's an external source on linking from the Google guide: Write descriptive link text

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent linking convention. A new style guide will merge shortly that will include more linking conventions. Here's an external source on linking from the Google guide: Write descriptive link text

That's a duplicate link.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot AI lite review requested due to automatic review settings September 24, 2026 08:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

A critical quickstart issue and additional documentation corrections remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
What changed in this PR

Updates database documentation to warn about postgres.js pipelining incompatibility with Supavisor transaction mode.

Changes:

  • Documents transaction-mode pipelining limitations and failure risks.
  • Adds Postgres.js guidance, support escalation, and upstream context.
  • Updates the connection example to disable prepared statements.
File Summary Findings
apps/​docs/​content/​guides/​database/​postgres-js.mdx Adds pipelining warnings and updates connection guidance. Critical quickstart guidance remains unsafe for transaction mode; moderate prepared-statement and spelling allow-list issues; nit on roadmap wording.
apps/​docs/​content/​guides/​database/​connecting-to-postgres.mdx Documents pipelining under transaction-mode limitations. Moderate link-description issue and nit regarding adjacent admonitions.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.


const connectionString = process.env.DATABASE_URL
const sql = postgres(connectionString)
const sql = postgres(connectionString, { prepare: false })

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not true. Whether a transaction pooler is used or not depends on the connection string passed through the DATABASE_URL.

@mentels
mentels requested a review from czenko September 24, 2026 09:19
@mentels
mentels merged commit c3c741c into master Sep 25, 2026
39 checks passed
@mentels
mentels deleted the docs/postgres-js-pipelining-warning branch September 25, 2026 08:51
@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1790326502)

Score Average Improvements Regressions
Completeness 95.2% (+0pp) 2 🟢 2 🔴
Conciseness 62.2% (-1pp) 11 🟢 15 🔴
Correctness 83.7% (+0pp) 2 🟢 5 🔴
Docs Faithfulness 57.9% (-3pp) 3 🟢 4 🔴
Goal Completion 80.2% (+0pp) 2 🟢 3 🔴
Knowledge Usage 92.9% (+0pp) - -
SQL Identifier Quoting 100% (+0pp) - -
SQL Validity 100% (+0pp) - -
Safety 93.3% (+5pp) 1 🟢 -
Tool Usage 87.9% (+0pp) - 1 🔴
URL Validity 98.5% (-2pp) - 1 🔴
Time_to_first_token 2.51tok (-0.06tok) 22 🟢 25 🔴
Llm_calls 10.9 (+0.29) 16 🟢 15 🔴
Tool_calls 7.22 (+0.11) 11 🟢 7 🔴
Errors 0.03 (0) - -
Llm_errors 0 (+0) - -
Tool_errors 0.03 (0) - -
Prompt_tokens 64790.72tok (+17.53tok) 20 🟢 26 🔴
Prompt_cached_tokens 49129.81tok (-1231.57tok) 30 🟢 18 🔴
Prompt_cache_creation_tokens 15640.69tok (+1248.61tok) 24 🟢 24 🔴
Prompt_cache_creation_5m_tokens 0tok (+0tok) - -
Prompt_cache_creation_1h_tokens 0tok (+0tok) - -
Completion_tokens 1465.68tok (-8.97tok) 19 🟢 29 🔴
Completion_reasoning_tokens 412.42tok (-23.15tok) 21 🟢 27 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 66256.4tok (+8.56tok) 23 🟢 25 🔴
Estimated_cost 0$ (+0$) 15 🟢 18 🔴
Duration 12.9s (-0.56s) 26 🟢 21 🔴
Llm_duration 25.05s (-1.08s) 24 🟢 23 🔴

ljukas added a commit to ljukas/videbacken that referenced this pull request Sep 29, 2026
## Why

Since #29, every full page load of `/charging` in prod hung until
Vercel's 300 s timeout (504); client-side navigation still worked.
postgres.js pipelines a query onto a busy connection (after a
parameterless query, with `prepare: false`), and Supabase's transaction
pooler drops the replies to pipelined queries. #29 put a parameterless
query (`tariff.list`) into an SSR loader that runs ~15 queries at once.
During a live hang, prod `pg_stat_activity` showed one backend per
request `active` / `ClientRead`, waiting for a query the client never
finished. Supabase documents the incompatibility
(supabase/supabase#50712) and advises against `max_pipeline: 0`, which
breaks `sql.begin()` (porsager/postgres#1189). node-postgres sends one
query per connection and waits for its reply.

## What changed

- Drizzle on `pg` (`drizzle-orm/node-postgres`) instead of postgres.js,
with a pool `error` handler: pg otherwise crashes the process on an idle
client's socket error.
- `sslmode=require`/`prefer` URLs get `uselibpqcompat=true`: pg
otherwise reads them as `verify-full` and rejects Supabase's
certificate. That would have broken the app and `drizzle-kit migrate` in
`vercel-build`, so encrypt-without-verify stays as it was.
- No `attachDatabasePool`: its ~10 s `waitUntil` per query would bill
Fluid instances ~100× longer (ADR-0018).
- Separate commit: `connectionTimeoutMillis` 10 s and `query_timeout` 30
s, so a future stall errors fast instead of burning 300 s.
- Driver differences: `constraint` instead of `constraint_name`, `{ rows
}` from raw `execute`, `test/setup.ts` on the pg pool.

## Verification

- [x] `bun run check` clean
- [x] `bun run build` passes (tsc + bundle)
- [x] `bun run test` passes: 98 files, 990 tests
- [ ] Preview deploy: `drizzle-kit migrate` connects over TLS, and a
full page load of `/charging` renders and hydrates. The stall only
happens behind Supabase's pooler, so it can't be reproduced locally.
- Two reviews (code/ADR, and adversarial). Both blockers fixed: the pool
`error` handler and not forcing libpq semantics on `sslmode=no-verify`.

## Risks / follow-ups

- The first deploy is the first pg + Supabase TLS connection, including
migrations. Watch the build's migrate step.
- A query that times out inside a transaction leaves its client busy, so
the rollback can still wait.
- postgres.js stays in `bun.lock` only as drizzle-orm's optional peer;
nothing imports it.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants