SQLSTATE 3F000 ERROR Class 3F: Invalid Schema Name

invalid_schema_name schema “…” does not exist — 3F000

PostgreSQL error "schema "…" does not exist" (SQLSTATE 3F000): what it means, common causes, and how to fix it.

PG 12, 13, 14, 15, 16, 17, 18 Official docs
Last reviewed May 2025 Grounded in source

Diagnostic Queries

Symptoms

A statement referenced a schema that does not exist in the current database. PostgreSQL raises SQLSTATE 3F000 (invalid_schema_name).

  • Common in qualified names like reporting.orders.
  • Also from a search_path pointing at a missing schema.
  • Schema names are case-sensitive unless created unquoted.

What the server log shows

ERROR:  schema "reporting" does not exist

Why PostgreSQL raises this — what the manual says

As Section 5.10 Schemas explains:

A statement referenced a schema-qualified name (schema.object) whose schema does not exist in the current database; the schema must be created with CREATE SCHEMA, or the name corrected, before the object can be resolved.

Objects are resolved within schemas listed in search_path or named explicitly. If the referenced schema is absent from pg_namespace, resolution fails with 3F000.

Common causes

  • Typo or wrong case in the schema name.
  • The schema was never created or was dropped.
  • A search_path referencing a non-existent schema.

How to fix it

  1. List schemas: \dn in psql or SELECT nspname FROM pg_namespace;.
  2. Create it: CREATE SCHEMA reporting;.
  3. Fix the qualified name or the search_path.

Related & next steps

Reference: PostgreSQL 18 Section 5.9 “Schemas”.

Was this helpful?