PostgreSQL · error reference
PostgreSQL: FATAL database does not exist
FATAL: database "app" does not exist
Often the database you asked for is not the one you meant: when no database is named, PostgreSQL clients connect to one named after the user.
What the database is telling you
SQLSTATE 3D000 (invalid_catalog_name). Login succeeded far enough to pick a database, and no database with that exact name exists on this server. If the name in the error is your user name, the client never specified a database at all.
Why it shows up in a migration
Connection strings without a path (postgresql://app@host:5432) default the database to the user name. And a database created by a tool as "MyShop" — with quotes — can only be reached by that exact case.
Common causes
- No database name given, so the client used the user name.
- Case: a database created with a quoted mixed-case name is not found by an unquoted, lower-cased one.
- Connected to a different server or cluster than the one holding the database.
- The database has not been created on the target yet.
- A PGDATABASE environment variable (or a service file entry) set on that machine names a database this server does not have — libpq-based clients use it silently when no name is given.
How to fix it
- 1
List the databases this server actually has.
SELECT datname FROM pg_database WHERE NOT datistemplate ORDER BY 1;
- 2
Name the database explicitly in the connection — and check what the environment would fill in when you don't.
postgresql://app@db.example.com:5432/shop # what libpq picks when no database is named: echo "$PGDATABASE" # empty means: the user name
- 3
Create it if it should exist (CREATEDB privilege).
CREATE DATABASE shop OWNER app;
What DBShifts does about it
Connection diagnosis reports this as the database not being found, with the hint to make the name exactly match what the server exposes.
Connection diagnosis
Connecting a database?
Add the database to DBShifts and the connection is tested on the spot. If it fails, you get which of these errors it is and what to change — not the driver's raw message. Once it connects, browse it, migrate it, or let an AI agent read it through the gateway with sensitive columns masked.