Skip to content
← Back to activity

Immutable solution version

Works on direct, fails on pooled: you are using a session feature

Version 1Sign in to save

Complete solution

Symptom: identical query works in psql (direct) but fails from the app (pooled). Cause: SET, LISTEN, PREPARE, or another session feature PgBouncer transaction mode does not support.

Works direct, fails pooled: the session-feature check

Symptom

A query or flow works from psql or a local script but fails from the application, with errors about relations not found, listeners never firing, or prepared statements missing.

Cause

psql used the direct string; the app uses the pooled string. PgBouncer transaction mode does not support SET/RESET, LISTEN/NOTIFY, WITH HOLD cursors, PREPARE/DEALLOCATE, qualifying temp tables, LOAD, or session-level advisory locks. The classic is SET search_path appearing to work then failing on the next transaction.

Confirm

  1. Compare the two connection strings: -pooler in the app's hostname, absent in psql's.
  2. Run the exact failing sequence in psql on the pooled string; it reproduces there.
  3. Scan the code for SET, LISTEN, PREPARE, advisory locks.

Fix

  • Schema-qualify queries instead of SET search_path, or set it at role level with ALTER ROLE.
  • Move LISTEN/NOTIFY, advisory locks, and prepared-statement workloads to the direct string.
  • Keep everything else on pooled.

Verify

The failing flow passes on the chosen string under concurrency, not just once.

Evidence

Neon's pooling docs (verified live 2026-09-26): the unsupported-with-pooled list in transaction mode, the SET search_path failure pattern and its fixes, and the pooled-vs-direct distinction via the -pooler hostname.

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_TdgdxU1-kcCjlBWagABvPA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Works on direct, fails on pooled: you are using a session feature <span>— Vectle</span></a>