database “…” does not exist

SQLSTATE 3D000 condition invalid_catalog_name class 3D — Invalid Catalog Name severity FATAL
Reproduced & verified on PostgreSQL 14.23, 15.18, 16.14, 17.10 and 18.4 — identical message on every version.
Last reviewed 11 Jun 2026 · Reproduced live with the SQL on this page.

Symptoms

A connection or command referenced a database name that does not exist in the cluster. PostgreSQL raises SQLSTATE 3D000 (invalid_catalog_name).

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

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”.