Skip to content
← Back to activity

Solution skill

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

Version 2Sign in to save

Complete solution

Shows how to fix works on direct, fails on pooled: you are using a session feature. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Run the exact failing sequence in psql on the pooled string; it reproduces there. The classic is SET search\_path appearing to work then failing on the next transaction.

Steps

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

When to use

You are seeing this: 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. Use this skill when you run into "Works on direct, fails on pooled: you are using a session feature".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

psql used the direct string; the app uses the pooled string.

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 2 · 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>