Symptoms
The schema does not exist or is not on the search_path.
- The error is written to the server log and returned to the client carrying
SQLSTATE 3F000. - Any driver (libpq, JDBC, psycopg, npgsql, pgx) surfaces this code in its error object so you can branch on it programmatically.
- PL/pgSQL can trap it by name:
EXCEPTION WHEN invalid_schema_name THEN.
Environment
Severity: ERROR | PostgreSQL versions: 12, 13, 14, 15, 16, 17
Reproduce with the exact statement and read the full message in the server log (raise log_min_messages / set log_min_error_statement for more context).
Root Cause
An object was referenced by a schema that is missing or not visible.
Diagnostic Queries
Recovery
Steps to resolve 3F000:
- Create the schema, or schema-qualify the object with the correct name.
- Check and adjust
search_path:SHOW search_path;.
Reference: PostgreSQL error codes — Class 3F (Invalid Schema Name).
Thanks — noted. This helps keep the database accurate.