SQLSTATE 26000Severity lowLab verified

Incident brief

Prepared statement does not exist

EXECUTE or DEALLOCATE of a prepared-statement name that was never prepared (or was already deallocated) raises this invalid-statement-name error.

Reproduced on PostgreSQL 18.4Verified 2026-07-24 (isolated lab, PostgreSQL 18.4)Reviewed by Verified against PostgreSQL 18.4 in an isolated lab environment

In 10 seconds

What
Prepared statement does not exist
What triggers it
EXECUTE a prepared-statement name that has not been PREPAREd in this session.
The fix
PREPARE the statement before you EXECUTE it, in the same session.
Proof
Reproduced on PostgreSQL 18.4 → An EXECUTE reproduces SQLSTATE 26000 because the named statement was never prepared in this session.

The fix

What to do right now

The immediate, application-level response to this error.

  • PREPARE the statement before you EXECUTE it, in the same session.
  • Ensure pooled connections re-prepare their statements after a reset — prepared statements are per-session.
Fix — SQL
-- Prepare the statement before executing it.
PREPARE monthly_report AS SELECT 1;
EXECUTE monthly_report;

Related & next steps

Follow the thread

Everything this error touches — jump straight to the sibling error, term, runbook, or parameter.

Verification

PG 18.4
Last verified
2026-07-24 (isolated lab, PostgreSQL 18.4)
Reviewed by
Verified against PostgreSQL 18.4 in an isolated lab environment
Audit status
reviewed