SQLSTATE 42P01Severity mediumLab verified

Incident brief

Relation does not exist

A query referenced a table that PostgreSQL couldn't find. Usually a typo — but the table can also just be in a schema that isn't being searched.

Reproduced on PostgreSQL 16.14Verified 2026-07-16 (Docker lab, PostgreSQL 16.14)Reviewed by Verified against PostgreSQL 16.14 in an isolated lab environment

In 10 seconds

What
Relation does not exist
What triggers it
Query a table name that doesn't exist anywhere in the database.
The fix
Fix a typo'd table name if that's the cause.
Proof
Reproduced on PostgreSQL 16.14 → Querying a table name that doesn't exist anywhere in the database was rejected with SQLSTATE 42P01. The session was unaffected afterward.

The fix

What to do right now

The immediate, application-level response to this error.

  • Fix a typo'd table name if that's the cause.
  • If the table exists in a different schema, qualify it (schema.table) or add that schema to search_path.
  • Double-check which schema a new object actually landed in — see the premium test below for how search_path decides this.
Fix — SQL
-- schema-qualify the table name directly, no search_path change needed
SELECT * FROM archive.daily_metrics;

Related & next steps

Follow the thread

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

Verification

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