↑↓ select↵ open⌫ change scopeOpen full search

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

Wiki / SQLSTATE

25002 — branch_transaction_already_active

25002 names a branch transaction that is already active. It is narrower than 25001 and separate from 25P02; this page records the locked condition definition and the absence of a resolved core 18.6 call site.

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
branch_transaction_already_active
lang
en
sqlstate
25002

Definition PG 18

25002 — branch_transaction_already_active

At a glance {#at-a-glance}

25002 names a branch transaction that is already active. It is narrower than 25001 and separate from 25P02; this page records the locked condition definition and the absence of a resolved core 18.6 call site.

Meaning {#meaning}

The code belongs to Class 25, but it should not be used as a generic label for nested transactions or savepoints. PostgreSQL’s core errcodes.txt defines the macro, while the exhaustive resolved 18.6 call scan in this project contains no direct 25002 report group.

Diagnosis {#diagnosis}

Use the exact server SQLSTATE and transaction context. Distinguish a branch/transaction-management API from ordinary savepoints, subtransactions, active transaction-block restrictions, and failed-transaction recovery. A missing core report group is not permission to infer a message or trigger from another code.

Response {#response}

Preserve the branch-management operation and its transaction boundary, then consult the API that created the branch. This batch does not provide a natural SQL repair because no safe core path was confirmed; do not replace the missing path with a hand-written RAISE example.

Source message templates {#messages}

Applicability boundary {#case}

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

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

Versions {#versions}

The locked catalogue observes the condition by 7.4 and in all listed formal snapshots. The 18.6 call scan has no resolved core path; extensions or future code may add one.

Related {#related}

Compare 25001 active SQL transaction, 25000 invalid transaction state, and 3B000 savepoint exception.

Sources {#sources}

  • src.errcodes.18.6 (SHA-256 6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba)
  • src.calls.REL_18_6 (SHA-256 9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf)

Compare versions

SQLSTATE evidence and recorded runtime versions

claims · identity
{
  "claim_id": "identity",
  "limits": "This is a narrow transaction-branch state, distinct from 25001 active_sql_transaction and 25P02 in_failed_sql_transaction.",
  "method": "Read the fixed errcodes row and macro.",
  "position": 0,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "25002 is branch_transaction_already_active in Class 25."
}
claims · source-boundary
{
  "claim_id": "source-boundary",
  "limits": "A missing core call-site is a bounded source observation; do not manufacture it with RAISE or a guessed replication topology.",
  "method": "Compare the errcodes macro mapping with all resolved report groups.",
  "position": 1,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6",
    "src.calls.REL_18_6"
  ],
  "statement": "The exhaustive resolved PostgreSQL 18.6 core call scan has no report group mapped to 25002, so this batch does not claim a safe natural SQL trigger."
}
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": ""
}

Source references

Full definition and evidence JSON

Definition sources

center · PostgreSQL 18 · english-manuals:81b9ce1e6900c64c430b0e57127110a92322dfad1c2c8aff97ec4457d30dfe6a

Text language: en · english-manuals:81b9ce1e6900c64c430b0e57127110a92322dfad1c2c8aff97ec4457d30dfe6a