↑↓ select↵ open⌫ change scopeOpen full search

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

Wiki / SQLSTATE

25000 — invalid_transaction_state

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.

English manual coverage begins with PostgreSQL 8.1. Source history and runtime observations have their own recorded version boundaries.

Reading PG 18·Select a recorded version

aliases
Unknown
class name
Invalid Transaction State
condition name
invalid_transaction_state
lang
en
sqlstate
25000

Definition PG 18

25000 — invalid_transaction_state

At a glance {#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 {#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 {#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 {#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 {#messages}

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

Applicability boundary {#case}

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 {#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.

Related {#related}

Compare 25001 active SQL transaction, 25P02 failed SQL transaction, and 40001 serialization failure.

Sources {#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)

Compare versions

SQLSTATE evidence and recorded runtime versions

claims · identity
{
  "claim_id": "identity",
  "limits": "It is a family-level state; active transactions, failed transactions, and parallel-operation restrictions have separate codes.",
  "method": "Read the fixed condition row and macro.",
  "position": 0,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "25000 is invalid_transaction_state, the broad Class 25 condition."
}
claims · core-paths
{
  "claim_id": "core-paths",
  "limits": "These guards depend on executor/parallel-worker state that a normal safe SQL session cannot establish directly.",
  "method": "Trace the fixed report groups and exact messages.",
  "position": 1,
  "runtime": [],
  "sources": [
    "src.xact.18.6",
    "src.utility.18.6",
    "src.calls.REL_18_6"
  ],
  "statement": "The locked PostgreSQL 18.6 source uses 25000 for internal parallel-operation guards such as defining savepoints or executing a utility during parallel operation."
}
claims · boundary
{
  "claim_id": "boundary",
  "limits": "Extensions or future code can add paths; this is a core 18.6 source boundary, not a universal impossibility theorem.",
  "method": "Compare the class mapping and exhaustive resolved-call scan.",
  "position": 2,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6",
    "src.calls.REL_18_6"
  ],
  "statement": "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."
}
messages · parallel-savepoint
{
  "limits": "The template is guarded by internal parallel-operation state and is not a user-facing active-transaction diagnostic.",
  "message_id": "parallel-savepoint",
  "path": "",
  "position": 0,
  "raw": {
    "id": "parallel-savepoint",
    "limits": "The template is guarded by internal parallel-operation state and is not a user-facing active-transaction diagnostic.",
    "primary_template": "cannot define savepoints during a parallel operation",
    "severity_source": "ERROR",
    "sources": [
      "src.xact.18.6"
    ],
    "sqlstate": "25000"
  },
  "severity": "ERROR",
  "sources": [
    "src.xact.18.6"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "cannot define savepoints during a parallel operation",
      "position": 0,
      "role": "",
      "template": "cannot define savepoints during a parallel operation"
    }
  ]
}
messages · parallel-utility
{
  "limits": "The %s substitution is the utility command name.",
  "message_id": "parallel-utility",
  "path": "",
  "position": 1,
  "raw": {
    "id": "parallel-utility",
    "limits": "The %s substitution is the utility command name.",
    "primary_template": "cannot execute %s during a parallel operation",
    "severity_source": "ERROR",
    "sources": [
      "src.utility.18.6"
    ],
    "sqlstate": "25000"
  },
  "severity": "ERROR",
  "sources": [
    "src.utility.18.6"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "cannot execute during a parallel operation",
      "position": 0,
      "role": "",
      "template": "cannot execute %s during a parallel operation"
    }
  ]
}
sources · src.errcodes.18.6
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/utils/errcodes.txt",
  "position": 0,
  "sha256": "6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba",
  "source_id": "src.errcodes.18.6",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt"
}
sources · src.calls.REL_18_6
{
  "commit": "",
  "docs_url": "",
  "kind": "local_artifact",
  "location": "",
  "path": "raw/calls/REL_18_6.jsonl",
  "position": 1,
  "sha256": "9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf",
  "source_id": "src.calls.REL_18_6",
  "tag": "",
  "url": ""
}
sources · src.xact.18.6
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/access/transam/xact.c",
  "position": 2,
  "sha256": "75b012c0b047d1dc905a30975c244beec366e45eac0dbf109fd21bcd611a8e39",
  "source_id": "src.xact.18.6",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/transam/xact.c#L4385-L4387"
}
sources · src.utility.18.6
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/tcop/utility.c",
  "position": 3,
  "sha256": "7aae5d07628b6debf8456d1d4ea96f28912232192e56ea25773b4c4b61235a00",
  "source_id": "src.utility.18.6",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/tcop/utility.c#L425-L429"
}

Source references

Full definition and evidence JSON

Definition sources

center · PostgreSQL 18 · english-manuals:f9b97bb0346150f358b73e8571c822745aa76db203a34416cc24eed79e2b9be0

Text language: en · english-manuals:f9b97bb0346150f358b73e8571c822745aa76db203a34416cc24eed79e2b9be0