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.

What lands in your log

ERROR: relation "monthly_report" does not exist

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

In 10 seconds

What triggers it
Query a table name that doesn't exist anywhere in the database.
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.

Fix

What to do right now

Application-level steps for 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
CREATE TABLE monthly_report (
  report_day date PRIMARY KEY,
  total bigint NOT NULL DEFAULT 0
);
INSERT INTO monthly_report(report_day, total)
VALUES (CURRENT_DATE, 1);
SELECT * FROM monthly_report;

Verification

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

Went further?

Pro unlocks the second lab proof

Free page stops the bleeding. Pro adds the operational test, SQLSTATE audit, and deeper evidence, same error, more certainty.

FollowSubstackLinkedInnew errors · lab notes · hiring loops