select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

SQLSTATE / CLASS 25 · INVALID TRANSACTION STATE

invalid_transaction_state

SQLSTATE
25000
Condition name
invalid_transaction_state
Class
Invalid Transaction State
Source macro
ERRCODE_INVALID_TRANSACTION_STATE
Evidence
Source path confirmed
Analysis & operational context

English SQLSTATE atlas: authored explanations and source/runtime evidence are separate from the manual definitions. View source ↗

<h1>25000 — invalid_transaction_state</h1>

At a glance

25000 is the broad Class 25 invalid transaction state. The locked 18.6 source uses it for internal states such as executing a utility or defining a savepoint during a parallel operation. This batch does not claim a safe ordinary SQL reproduction.

Meaning

Transaction state is more specific than “a transaction exists”. The same class contains 25001 for active transaction restrictions and 25P02 for a failed transaction. The resolved 18.6 call scan shows 25000 guards in heap access, transaction, utility, GUC, and savepoint paths that depend on parallel-worker state.

Diagnosis

First distinguish a failed transaction (25P02), an active transaction block restriction (25001), and a parallel-operation state (25000). For a natural client error, preserve the exact source SQLSTATE and message; do not infer 25000 from a generic “transaction is open” observation.

Response

Follow the command’s documented transaction and parallel-worker contract. If the server reports a recoverable client transaction state, use the exact rollback or retry boundary; if it is an internal parallel-operation guard, collect server logs and context before changing application SQL. Do not manufacture a natural result with RAISE.

Source message templates

  • parallel-savepoint: primary cannot define savepoints during a parallel operation (ERROR).
  • parallel-utility: primary cannot execute %s during a parallel operation (ERROR).

Applicability boundary

This batch does not construct a natural SQL trigger for 25000; treat it as a source/protocol boundary rather than a copyable reproduction. structured evidence · case export.

Authored evidence IDs: identity, core-paths, boundary. Selected runtime records: —.

Versions

The locked catalogue observes the condition by 7.4 and in all listed formal snapshots. The 18.6 source scan confirms the cited parallel-operation paths; this page intentionally has no runtime case because the required internal state is not a safe standalone SQL precondition.

Sources

  • src.errcodes.18.6 (SHA-256 6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba)
  • src.calls.REL_18_6 (SHA-256 9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf)
  • src.xact.18.6 (SHA-256 75b012c0b047d1dc905a30975c244beec366e45eac0dbf109fd21bcd611a8e39)
  • src.utility.18.6 (SHA-256 7aae5d07628b6debf8456d1d4ea96f28912232192e56ea25773b4c4b61235a00)

Source evidence

Evidence belongs to the frozen source and runtime versions listed here. It is not a runtime verification of the selected manual version.

25000 is invalid_transaction_state, the broad Class 25 condition.

Method: Read the fixed condition row and macro.

Limits: It is a family-level state; active transactions, failed transactions, and parallel-operation restrictions have separate codes.

src.errcodes.18.6

The locked PostgreSQL 18.6 source uses 25000 for internal parallel-operation guards such as defining savepoints or executing a utility during parallel operation.

Method: Trace the fixed report groups and exact messages.

Limits: These guards depend on executor/parallel-worker state that a normal safe SQL session cannot establish directly.

src.xact.18.6 src.utility.18.6 src.calls.REL_18_6

The batch does not claim a natural SQL reproduction for 25000. Use 25001 for an active transaction blocking a utility and 25P02 for a failed transaction; do not replace this boundary with RAISE.

Method: Compare the class mapping and exhaustive resolved-call scan.

Limits: Extensions or future code can add paths; this is a core 18.6 source boundary, not a universal impossibility theorem.

src.errcodes.18.6 src.calls.REL_18_6

Message templates

ERROR · parallel-savepoint

Primary

cannot define savepoints during a parallel operation

The template is guarded by internal parallel-operation state and is not a user-facing active-transaction diagnostic.

ERROR · parallel-utility

Primary

cannot execute %s during a parallel operation

The %s substitution is the utility command name.

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:0ec02b7b1b0b5ac4e8aa2d4cce2… · English manual source