2D000
Read PG 18 manual ↗invalid_transaction_termination
- SQLSTATE
- 2D000
- Condition name
- invalid_transaction_termination
- Class
- Invalid Transaction Termination
- Source macro
- ERRCODE_INVALID_TRANSACTION_TERMINATION
- Evidence
- Source path confirmed
English SQLSTATE atlas: authored explanations and source/runtime evidence are separate from the manual definitions. View source ↗
At a glance
2D000 is the SPI guard used when a procedure or subtransaction context attempts an invalid transaction termination. The fixed 18.6 path distinguishes invalid termination from a normal explicit COMMIT; this batch does not claim that every procedure-level transaction error is 2D000, and it does not fabricate a RAISE-based SQL example.
Meaning
2D000 is the SPI invalid transaction termination condition. In the fixed spi.c path, SPI_commit and SPI_rollback reject termination in an atomic SPI context; they also reject commit or rollback while a subtransaction is active. The source comments tie that restriction to procedural languages that use subtransactions for exception blocks.
Diagnosis
Locate the routine and SPI caller that attempted transaction control. Distinguish a top-level CALL that is allowed to control a transaction from a function or exception block whose SPI context is atomic, and check whether a nested subtransaction is active. The fixed source templates are invalid transaction termination, cannot commit while a subtransaction is active, and cannot roll back while a subtransaction is active; an ordinary client COMMIT error is not enough to classify this path.
Response
Move transaction control to an allowed procedure boundary, or let the surrounding procedure/exception block finish its subtransaction before terminating the top-level transaction. Do not issue COMMIT or ROLLBACK again inside the same forbidden SPI context, and do not apply a generic retry recipe. This batch records the source path only; no artificial RAISE or unfaithful SQL reproduction is used.
Versions
The locked facts table records catalogue presence across the project snapshot range. The fixed source evidence is limited to the path stated below; no exact behavioral introduction or broader runtime coverage is inferred from the definition alone.
Sources
src.errcodes.18.6(SHA-2566e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba)source path(SHA-2567244b45f632583c72530832df901b788fe403c8857425dd13edb49d9f84b0c78)
Source evidence
Evidence belongs to the frozen source and runtime versions listed here. It is not a runtime verification of the selected manual version.
2D000 is the invalid_transaction_termination condition in Class 2D.
Method: Read the fixed errcodes.txt row and macro mapping.
Limits: This records the protocol definition and does not imply a natural PostgreSQL throw path.
invalid transaction termination is a source-confirmed path for 2D000.
Method: Trace the fixed source call scan and classify the path before selecting a safe runner case.
Limits: No representative runtime case is claimed; the path requires a specialized internal or trigger/procedure context.
- src/backend/utils/errcodes.txt · REL_18_6 ·
724edf9bde9d356724ad384a2e196edc3c9f80f7 raw/calls/REL_18_6.jsonl· ·- src/backend/executor/spi.c · REL_18_6 ·
724edf9bde9d356724ad384a2e196edc3c9f80f7
Message templates
ERROR · message.invalid-transaction-termination
Primary
invalid transaction termination
The same source path also emits more specific subtransaction messages.
ERROR · message.commit-subtransaction
Primary
cannot commit while a subtransaction is active
Only the active-subtransaction branch uses this wording.
ERROR · message.rollback-subtransaction
Primary
cannot roll back while a subtransaction is active
Only the active-subtransaction rollback branch uses this wording.
Reproduction & repair cases
invalid_transaction_termination_boundary · PG 10, 18
Preconditions
- A runner-owned disposable target is provisioned.
Trigger: No generic SQL-only transaction-termination case is executed; the fixed SPI procedure/subtransaction guard is recorded as a source boundary.
Expected assertions
Repair: Keep transaction control at the procedure boundary supported by the server; do not add COMMIT/ROLLBACK inside a context that forbids termination.
Cleanup: Drop the case schema with an owner connection.
Recorded runtime evidence
No runtime observation is attached to this entry.
Definition snapshot: english-manuals:3234638209dacf1decd3b145c80… · English manual source