百科 / 错误代码 / Class 57 操作员干预
57P04 database_dropped
ERROR 源码确认 参考 未实测
- 条件名
database_dropped- 宏名称
ERRCODE_DATABASE_DROPPED- 启用版本
- 9.0
- 状态
- 活跃
版本覆盖
速览
57P04 在 recovery conflict 因当前连接所在数据库必须被删除而终止 session 时选用。同一 recovery-conflict primary 也用于其他冲突原因,但那些分支选择 40001;这里决定条件身份的是 database-dropped guard。
含义
固定调用点以 FATAL 发出 primary terminating connection due to conflict with recovery、动态 recovery-conflict detail 以及 hint In a moment you should be able to reconnect to the database and repeat your command.。SQLSTATE 表达式是明确的:只有 reason == PROCSIG_RECOVERY_CONFLICT_DATABASE 时选择 ERRCODE_DATABASE_DROPPED;同一终止分支的其他 reason 选择 ERRCODE_T_R_SERIALIZATION_FAILURE。数据库分支的 detail 是 User was connected to a database that must be dropped.。
消息
- primary:
terminating connection due to conflict with recovery,FATAL。 - 数据库删除 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.。 - 其他 recovery-conflict reason 可能复用相同 primary,但选择
40001和不同 detail;不能只凭 primary 把它们标成57P04。
报文模板
源码里的格式串,不是某一次运行的输出。%s 之类是占位符,实际报文会填入对象名与取值。适用范围一栏是核验时留下的原始英文记录,未经翻译。
terminating connection due to conflict with recovery
User was connected to a database that must be dropped.
In a moment you should be able to reconnect to the database and repeat your command.
来源:src/backend/tcop/postgres.c @ REL_18_6 · src/backend/tcop/postgres.c @ REL_18_6
诊断
保留 SQLSTATE、primary/detail/hint、数据库名、backend PID、recovery-conflict reason 及 standby/recovery 日志。确认 detail 指向被删除的数据库后,才按 57P04 处理。FATAL 报告会关闭连接,因此没有可发送 ROLLBACK 的 session。断开前中断的操作是否已提交,需要单独核对。
处理
等待 recovery conflict/数据库转换结束,连接到有效数据库,并在重放非幂等操作前核对持久化业务状态。若服务器返回带 40001 的其他 recovery-conflict detail,应使用 serialization/retry 处理。数据库仍在删除或 recovery 日志表明冲突活跃时,不要盲目反复重连。
版本
锁定目录从 9.0.4 记录此条件;该目录边界不等于精确实现引入版本。固定源码覆盖 PostgreSQL 18.6。
来源
- 上游源码 src/backend/utils/errcodes.txt 第 438 行
- 上游源码 src/backend/tcop/postgres.c 第 3241 行
- 上游源码 src/backend/tcop/postgres.c 第 2549 行
证据
断言
每条断言都写明了是怎么核实的,以及它不覆盖什么。这一层是核验时留下的原始英文记录,照原样呈现,未经翻译。
-
57P04 is database_dropped in SQLSTATE Class 57.
-
The cited PostgreSQL 18.6 source paths support the concrete phase, message, and lifecycle boundary described.
-
The locked catalogue records 57P04 from 9.0.4; that boundary does not prove exact implementation introduction.
-
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.
同类错误代码
Class 57 操作员干预 下的其他成员。