选择 打开 改范围 完整检索页

pgsql.cc 提供对 postgresql.org 官网内容的中文翻译,由 Pigsty 团队维护。

百科 / 错误代码 / Class 40 事务回滚

40000 transaction_rollback

事务回滚

ERROR 源码确认 参考 未实测

类别
Class 40 事务回滚
严重等级
ERROR
条件名
transaction_rollback
宏名称
ERRCODE_TRANSACTION_ROLLBACK
启用版本
7.4
状态
活跃

版本覆盖

速览

40000 是事务回滚的总括条件。18.6 固定源码包含 transaction aborted during system catalog scan 的内部系统目录扫描路径;复现它需要安全 SQL 案例之外的内部故障或可见性条件。不要把序列化失败、死锁或任意客户端取消改称 40000。

含义

40000 是宽泛的事务回滚条件。genam.c 中解析到的核心路径是防御性内部错误:系统目录扫描期间事务已中止。它不是 40001 表示的常规客户端重试路径,也不是死锁报告。

报文模板

源码里的格式串,不是某一次运行的输出。%s 之类是占位符,实际报文会填入对象名与取值。适用范围一栏是核验时留下的原始英文记录,未经翻译。

主消息 transaction aborted during system catalog scan

来源:src/backend/access/index/genam.c @ REL_18_6

适用范围:This is an internal catalog-scan path; ordinary client rollback has no basis to use this template.

诊断

若真实出现 40000,保存服务器日志、后端 PID、操作和源码诊断;固定主模板是 transaction aborted during system catalog scan。检查日志是否指向内部目录/索引可见性问题或服务器故障。客户端 ROLLBACK、序列化失败或语句取消都不能证明该码,选定扫描也没有安全的纯 SQL 复现。

处理

按服务器要求结束失败事务,并在重试前调查目录/索引和服务器健康状态。只有会话不可用时才重连,重做写入前先核对持久化结果。不要把 4000140P01 或普通回滚改称 40000;本页只记录内部源码边界。

可复现案例

在一次性实例上执行过的场景。

transaction_rollback_boundary PG 10 / 18

前置条件

  • A runner-owned disposable target is provisioned.

触发

No internal system-catalog-scan fault is injected; the fixed source path remains a source-only boundary.

处置

Treat this umbrella as a transaction rollback outcome only after identifying the concrete source mechanism; do not retry an unknown internal failure blindly.

清理

Drop the case schema with an owner connection.

版本

上面的锁定事实表记录项目快照范围内的目录存在情况。固定源码证据只覆盖下面声明的路径;不能仅从定义推导精确行为引入版本或更广的运行覆盖。

来源

证据

断言

每条断言都写明了是怎么核实的,以及它不覆盖什么。这一层是核验时留下的原始英文记录,照原样呈现,未经翻译。

  • 40000 is the transaction_rollback condition in Class 40.

    核实方式Read the fixed errcodes.txt row and macro mapping.

    不覆盖This records the protocol definition and does not imply a natural PostgreSQL throw path.

    来源src/backend/utils/errcodes.txt

  • transaction aborted during system catalog scan is a source-confirmed path for 40000.

    核实方式Trace the fixed source call scan and classify the path before selecting a safe runner case.

    不覆盖No representative runtime case is claimed; the path requires a specialized internal or trigger/procedure context.

    来源src/backend/access/index/genam.c · raw/calls/REL_18_6.jsonl

同类错误代码

Class 40 事务回滚 下的其他成员。