57P04
Read PG 18 manual ↗database_dropped
- SQLSTATE
- 57P04
- Condition name
- database_dropped
- Class
- Operator Intervention
- Source macro
- ERRCODE_DATABASE_DROPPED
- Evidence
- Source path confirmed
English SQLSTATE atlas: authored explanations and source/runtime evidence are separate from the manual definitions. View source ↗
At a glance
57P04 is selected when a recovery conflict terminates a session because the connected database must be dropped. The same recovery-conflict primary is used for other conflict reasons, but those branches select 40001; the database-dropped guard is the condition identity that matters here.
Meaning
The fixed call site uses FATAL with primary terminating connection due to conflict with recovery, dynamic recovery-conflict detail, and hint In a moment you should be able to reconnect to the database and repeat your command.. The SQLSTATE expression is explicit: ERRCODE_DATABASE_DROPPED is selected only when reason == PROCSIG_RECOVERY_CONFLICT_DATABASE; other reasons in this terminating branch use ERRCODE_T_R_SERIALIZATION_FAILURE. For the database branch, the detail is User was connected to a database that must be dropped..
Messages
- Primary:
terminating connection due to conflict with recovery, FATAL. - Database-drop detail:
User was connected to a database that must be dropped. - Hint:
In a moment you should be able to reconnect to the database and repeat your command. - Other recovery-conflict reasons can reuse the primary but select
40001and a different detail; do not label them57P04from the primary alone.
Diagnosis
Preserve SQLSTATE, primary/detail/hint, database name, backend PID, recovery-conflict reason, and standby/recovery logs. Confirm that the detail identifies the dropped database before treating the condition as 57P04. The FATAL report closes the connection, so there is no session in which to issue ROLLBACK. Check whether the interrupted operation could have committed before disconnection.
Response
Wait for the recovery conflict/database transition to clear, reconnect to a valid database, and verify durable business state before replaying a non-idempotent operation. If the server reports another recovery-conflict detail with 40001, apply serialization/retry handling instead. Do not repeatedly reconnect while the database is still being dropped or while recovery logs show the conflict is active.
Versions
The locked catalogue records this condition from 9.0.4; that boundary does not prove the exact implementation-introduction version. Fixed source coverage is PostgreSQL 18.6.
Sources
src/backend/tcop/postgres.c#L3233-3248
src/backend/tcop/postgres.c#L2549-2578
The structured evidence record records the SQLSTATE guard, dynamic detail, and source/runtime boundary.
Source evidence
Evidence belongs to the frozen source and runtime versions listed here. It is not a runtime verification of the selected manual version.
The cited PostgreSQL 18.6 source paths support the concrete phase, message, and lifecycle boundary described.
Method: Read complete fixed source contexts.
Limits: Source confirmation is not natural runtime.
The locked catalogue records 57P04 from 9.0.4; that boundary does not prove exact implementation introduction.
Method: Use catalogue boundary.
The terminating recovery-conflict call selects ERRCODE_DATABASE_DROPPED only for PROCSIG_RECOVERY_CONFLICT_DATABASE; other reasons select ERRCODE_T_R_SERIALIZATION_FAILURE and use a different detail.
Method: Read the complete guard and errdetail_recovery_conflict helper.
- src/backend/utils/errcodes.txt · REL_18_6 ·
724edf9bde9d356724ad384a2e196edc3c9f80f7 - src/backend/tcop/postgres.c · REL_18_6 ·
724edf9bde9d356724ad384a2e196edc3c9f80f7 - src/backend/tcop/postgres.c · REL_18_6 ·
724edf9bde9d356724ad384a2e196edc3c9f80f7
Message templates
FATAL · message.0
Primary
terminating connection due to conflict with recovery
Detail
User was connected to a database that must be dropped.
Hint
In a moment you should be able to reconnect to the database and repeat your command.
Reproduction & repair cases
No reproduction case is attached to this condition.
Recorded runtime evidence
No runtime observation is attached to this entry.
Definition snapshot: english-manuals:8d57aee0877a052ced34a7d7400… · English manual source