PostgreSQL error 3D000 means you specified a database name that doesn't exist or is misspelled. Fix it by verifying the database name exists and checking your connection string.
In PostgreSQL, a "catalog" refers to a database. Error 3D000 "Invalid catalog name" occurs when your application attempts to connect to or use a database that doesn't exist in the PostgreSQL server. This is a connection-level error that prevents any queries from executing. The error can be triggered by: - Specifying a non-existent database name in your connection string - Mistyping the database name - Attempting to connect after a database has been dropped - Using a different database name than what was created during setup
Connect to PostgreSQL as a superuser and list all databases:
psql -U postgresThen in the PostgreSQL prompt:
\lThis shows all databases. Look for the database name you're trying to connect to. If it doesn't appear in the list, you need to create it.
Verify the database name in your connection string matches exactly (case-sensitive). Common connection string formats:
postgresql://user:password@localhost:5432/dbnameEnsure:
- The database name is spelled correctly
- No extra spaces or special characters
- The database exists (from step 1)
Check in:
- Environment variables (.env, .env.local)
- Configuration files (config.js, database.yml, etc.)
- Application code with hardcoded connections
If the database is missing, create it:
CREATE DATABASE mydbname;For specific character encoding:
CREATE DATABASE mydbname
ENCODING 'UTF8'
LC_COLLATE 'C'
LC_CTYPE 'C'
TEMPLATE template0;Then reconnect with the correct connection string.
Some tools (Ecto, Rails, etc.) use a "maintenance database" to create/drop other databases. By default it's "postgres", but some cloud providers use different names:
# Ecto example
config :myapp, MyApp.Repo, maintenance_database: "defaultdb"# Rails example
adapter: postgresql
database: <%= ENV["DB_NAME"] %>
maintenance_db: defaultdbCheck your database hosting provider's documentation for the correct maintenance database name.
PostgreSQL error codes follow the SQL standard. 3D000 specifically means "INVALID CATALOG NAME" in the Class 3D category. When catching this error in application code, check for SQLSTATE 3D000. In PL/pgSQL, you can catch it with: WHEN SQLSTATE '3D000' THEN ... Some hosted PostgreSQL providers (DigitalOcean, AWS RDS) create a default database with a different name than "postgres" - always check your provider's documentation. For connection pooling tools like PgBouncer, ensure the database exists in the PostgreSQL server, not just in PgBouncer's configuration.
insufficient columns in unique constraint for partition key
How to fix "insufficient columns in unique constraint for partition key" in PostgreSQL
ERROR 42501: must be owner of table
How to fix "must be owner of table" in PostgreSQL
trigger cannot change partition destination
How to fix "Trigger cannot change partition destination" in PostgreSQL
SSL error: certificate does not match host name
SSL error: certificate does not match host name in PostgreSQL
No SSL connection
No SSL connection to PostgreSQL