SQLSTATE 3D000 FATAL Class 3D: Invalid Catalog Name

invalid_catalog_name database “…” does not exist — 3D000

PostgreSQL error "database "…" does not exist" (SQLSTATE 3D000): 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 connection or command referenced a database name that does not exist in the cluster. PostgreSQL raises SQLSTATE 3D000 (invalid_catalog_name).

  • Very common at connect time with a wrong/missing dbname.
  • Database names are case-sensitive unless created unquoted.
  • The default postgres database may be what you actually need.

What the server log shows

FATAL:  database "orders" does not exist

Why PostgreSQL raises this — what the manual says

Chapter 22 Managing Databases:

“Every instance of a running PostgreSQL server manages one or more databases.”

Each database is a catalog entry in pg_database. A connection request or cross-database reference naming a non-existent database cannot be resolved and is rejected with 3D000.

Common causes

  • Typo or wrong case in the database name.
  • The database was never created (or was dropped).
  • Connecting before a provisioning/migration step ran.

How to fix it

  1. List databases: \l in psql or SELECT datname FROM pg_database;.
  2. Create it: CREATE DATABASE orders;.
  3. Fix the connection string’s dbname (and case).

Related & next steps

Reference: PostgreSQL 18 Section 23 “Managing Databases”.

Was this helpful?