57P04FATALTier 1 — Safe✅ HIGH confidencedatabase dropped
🔴 Production Risk Error
Critical: the database and all its data are permanently deleted.
What this means
SQLSTATE 57P04 is raised when the database a session is connected to is dropped while the session is active. Postgres terminates all connections to the dropped database.
Why it happens
- 1A DBA ran DROP DATABASE on the database the current session is connected to
- 2DROP DATABASE WITH (FORCE) was used in Postgres 13+ to forcibly terminate active connections
How to reproduce
Database dropped while session is active.
-- From another session:
DROP DATABASE myapp WITH (FORCE);Fix 1: Reconnect to a different database
If the database drop was intentional.
Why this works
The dropped database no longer exists. Connect to a different database or create a new one.
Fix 2: Restore from backup if the drop was accidental
If DROP DATABASE was run by mistake.
Why this works
Restore from the most recent backup (pg_dump or pg_basebackup). There is no undo for DROP DATABASE — backups are essential.
What not to do
Run DROP DATABASE in production without explicit confirmation
Why it's wrong: DROP DATABASE is irreversible without a backup.
Version notes
Postgres 13+DROP DATABASE WITH (FORCE) added in Postgres 13.Dangerous variant
⚠️ Warning
57P04 from an accidental DROP DATABASE — data loss
Sources
📚 Official docs: https://www.postgresql.org/docs/current/errcodes-appendix.html
🔧 Source ref: Class 57 — Operator Intervention (Postgres-specific)
Confidence assessment
✅ HIGH confidence
Postgres-specific. Stable across versions.
See also
🔗 Related errors
📄 Reference pages