百科 / 错误代码 / Class 25 事务状态无效
25004 inappropriate_isolation_level_for_branch_transaction
分支事务隔离级别不适用
ERROR 仅定义 参考 不适用
- 条件名
inappropriate_isolation_level_for_branch_transaction- 宏名称
ERRCODE_INAPPROPRIATE_ISOLATION_LEVEL_FOR_BRANCH_TRANSACTION- 启用版本
- 7.4
- 状态
- 活跃
版本覆盖
速览
25004 表示分支事务使用了不适用的隔离级别。固定 PostgreSQL 18.6 核心解析调用扫描没有该码的直接报错组,因此不声称存在普通 SQL 复现。
含义
这是分支事务条件,区别于 40001 可串行化失败,也区别于普通事务中 SET TRANSACTION ISOLATION LEVEL 的检查。
诊断
诊断时应同时保留分支 API、请求的隔离级别和事务状态。现有源码证据不足以借用其他隔离级别错误的报文。
处理
修正分支 API 的隔离级别协商后,只有 API 明确定义可重试时才重试。普通 SQL 会话应按实际返回的 SQLSTATE 诊断。
可复现案例
在一次性实例上执行过的场景。
branch_transaction_boundary PG 10 / 18
前置条件
- A runner-owned disposable target is provisioned.
触发
Source/definition evidence only; no natural SQL trigger is claimed.
断言
- No fabricated SQL trigger is included; the selected run records a definition/source boundary.
处置
Follow the explicit transaction or source boundary described by the case.
清理
Drop the case schema with an owner connection.
源码报文与运行边界
固定 errcodes.txt 定义了该条件和宏;raw/calls/REL_18_6.jsonl 的解析调用扫描没有直接报错组,因此本批不发布报文模板,也不构造自然 SQL 触发器。
适用边界与案例
本批运行器在 PostgreSQL 18.6 与 10.21 的选定 case 均为 not_applicable,只记录源码边界,没有可复制的 SQL 触发过程。结构化证据 · 案例导出
版本与边界
生成事实记录锁定的目录快照。两个 runner 目标都是 case 状态为 not_applicable 的源码边界观察,不把自然触发计入运行覆盖。
来源
证据
断言
每条断言都写明了是怎么核实的,以及它不覆盖什么。这一层是核验时留下的原始英文记录,照原样呈现,未经翻译。
-
25004 is inappropriate_isolation_level_for_branch_transaction in Class 25.
-
The exhaustive resolved PostgreSQL 18.6 call scan contains no direct 25004 report group; no natural SQL reproduction is claimed.
运行记录
| 目标 | 服务器版本 | 结果 | 覆盖案例 |
|---|---|---|---|
| latest | 18.6 (Homebrew) | not_applicable | branch_transaction_boundary |
| pg10 | 10.21 (Debian 10.21-1.pgdg90+1) | not_applicable | branch_transaction_boundary |
同类错误代码
Class 25 事务状态无效 下的其他成员。
25000invalid_transaction_state25001active_sql_transaction25002branch_transaction_already_active25003inappropriate_access_mode_for_branch_transaction25005no_active_sql_transaction_for_branch_transaction25006read_only_sql_transaction25007schema_and_data_statement_mixing_not_supported25008held_cursor_requires_same_isolation_level25P01no_active_sql_transaction25P02in_failed_sql_transaction25P03idle_in_transaction_session_timeout25P04transaction_timeout