{
  "schema": 1,
  "sqlstate": "40001",
  "condition_name": "serialization_failure",
  "sources": [
    {
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "id": "src.errcodes.18.6",
      "location": "lines 329-333",
      "path": "src/backend/utils/errcodes.txt",
      "sha256": "6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba",
      "tag": "REL_18_6",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt"
    },
    {
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "id": "src.nodeModifyTable.18.6",
      "location": "lines 2595-2605",
      "path": "src/backend/executor/nodeModifyTable.c",
      "sha256": "0fc3cb180b3443f216142954e43d8ed5f84713d75094ce8cd2785ad8f604bd68",
      "tag": "REL_18_6",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/executor/nodeModifyTable.c#L2595-L2605"
    },
    {
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "id": "doc.mvcc.18",
      "location": "serialization failure handling",
      "path": "doc/src/sgml/mvcc.sgml",
      "sha256": "4b7bf77ee0af4b86052330ff2421d567df3604b75fe7d4f522bec84fdea87340",
      "tag": "PG18-docs",
      "url": "https://www.postgresql.org/docs/18/mvcc-serialization-failure-handling.html"
    },
    {
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "id": "doc.protocol.18",
      "location": "ErrorResponse fields",
      "path": "doc/src/sgml/protocol.sgml",
      "sha256": "745339e07ebbc2bb67d98b258e25772ada644ef26011e3cd6b3fcbb435235f89",
      "tag": "PG18-docs",
      "url": "https://www.postgresql.org/docs/18/protocol-error-fields.html"
    },
    {
      "id": "manifest.40001",
      "kind": "local_artifact",
      "location": "snapshots and definition_blobs entries for the 40001 definition",
      "sha256": "1727a275f336988ff96b4f9990a4ca253080f73fc5d316e7def165c8cf3708a8"
    },
    {
      "id": "case-manifest.40001",
      "kind": "local_artifact",
      "location": "serializable_stale_update",
      "sha256": "f763521e946921e560a2e2f769507be836cefae2ae2d0ca8d8d60a9c55c9e45b"
    },
    {
      "id": "snippet-registry.40001.final",
      "kind": "local_artifact",
      "location": "serializable_stale_update ordered SQL",
      "sha256": "7ed0b0bf4dc0bb2a2141a1cf9b223b61d80c9817ca041355d1f6527fbbb98007"
    }
  ],
  "claims": [
    {
      "id": "identity.class-and-condition",
      "limits": "Directory identity does not identify one serialization-conflict origin.",
      "method": "Read the Class 40 section and 40001 row in the frozen errcodes.txt snapshot.",
      "sources": [
        "src.errcodes.18.6"
      ],
      "statement": "40001 is the serialization_failure condition in Class 40 transaction_rollback."
    },
    {
      "id": "mechanism.concurrent-update",
      "limits": "Other serialization conflicts can use different messages or source paths while retaining SQLSTATE 40001.",
      "method": "Trace the ExecUpdate concurrent-update branch and compare the diagnostic from the stale serializable writer.",
      "sources": [
        "src.nodeModifyTable.18.6"
      ],
      "statement": "The executor update path reports ERRCODE_T_R_SERIALIZATION_FAILURE with could not serialize access due to concurrent update."
    },
    {
      "id": "runtime.fresh-snapshot-retry",
      "limits": "The fixed assignment is a controlled retry proof; it does not establish that an arbitrary business calculation is safe to replay. The run reads 1 and sets value=2; it does not test a business calculation decision.",
      "method": "Open both initial serializable snapshots before the first commit, trigger the stale update, roll it back, and assert the complete fresh read/fixed assignment/write retry and final value with registry transaction boundaries executed under autocommit=True.",
      "sources": [
        "doc.mvcc.18",
        "case-manifest.40001",
        "runtime.40001-manual-boundary-final-20260909.latest",
        "runtime.40001-manual-boundary-final-20260909.pg10"
      ],
      "statement": "The stale serializable writer entered INERROR after 40001; after ROLLBACK, a fresh serializable transaction read 1, wrote 2, committed, and left final value 2 on both targets."
    },
    {
      "id": "versions.catalogue-boundary",
      "limits": "The first scanned release is a lower bound, not an asserted introduction version.",
      "method": "Read the manifest snapshots and definition references for the code.",
      "sources": [
        "manifest.40001"
      ],
      "statement": "The locked catalogue records 40001 in every listed formal snapshot from 9.0.23 through 18.6 and in 19beta3; pre-9.0 history is not scanned."
    }
  ],
  "messages": [
    {
      "id": "message.concurrent-update",
      "limits": "The template is the observed executor update path; other serialization failures may carry different text or detail.",
      "primary_template": "could not serialize access due to concurrent update",
      "severity_source": "explicit ERROR",
      "sources": [
        "src.nodeModifyTable.18.6"
      ],
      "sqlstate": "40001"
    }
  ],
  "usage_evidence": [
    {
      "evidence_ids": [
        "identity.class-and-condition",
        "src.errcodes.18.6"
      ],
      "scope": "SQLSTATE directory identity",
      "status": "definition_only"
    },
    {
      "evidence_ids": [
        "mechanism.concurrent-update",
        "src.nodeModifyTable.18.6"
      ],
      "scope": "Executor concurrent-update message",
      "status": "source_path_confirmed"
    },
    {
      "evidence_ids": [
        "runtime.fresh-snapshot-retry",
        "snippet-registry.40001.final",
        "runtime.40001-manual-boundary-final-20260909.latest",
        "runtime.40001-manual-boundary-final-20260909.pg10"
      ],
      "scope": "Stale serializable transaction and complete fresh-snapshot retry",
      "status": "observed_runtime"
    },
    {
      "evidence_ids": [
        "versions.catalogue-boundary",
        "manifest.40001"
      ],
      "scope": "Version presence",
      "status": "definition_only"
    }
  ],
  "runtime": [
    {
      "cases": [
        "serializable_stale_update"
      ],
      "id": "runtime.40001-registry-final-20260909.latest",
      "observed": {
        "diagnostic": {
          "message_primary": "could not serialize access due to concurrent update",
          "severity": "ERROR",
          "source_file": "nodeModifyTable.c",
          "source_function": "ExecUpdate",
          "source_line": "2604",
          "sqlstate": "40001"
        },
        "final_value": 2,
        "reads": {
          "first": 0,
          "retry": 1,
          "stale": 0
        },
        "statuses": {
          "first_after_commit": "IDLE",
          "retry": "IDLE",
          "stale_after_error": "INERROR",
          "stale_after_rollback": "IDLE"
        }
      },
      "raw_sha256": "6a0f6ba16f654c5a3513a19647a5ef3a3e6908802133414d1a8ccd09de6a39ac",
      "run_id": "40001-registry-final-20260909",
      "server_version": "18.6 (Homebrew)",
      "server_version_num": 180006,
      "snippet_registry": {
        "sha256": "7ed0b0bf4dc0bb2a2141a1cf9b223b61d80c9817ca041355d1f6527fbbb98007"
      },
      "status": "passed",
      "summary_sha256": "d4d8fdec585ef6fbe571940646d91cda6568befc64e12211ee17888a6c5b2433",
      "target": "latest"
    },
    {
      "cases": [
        "serializable_stale_update"
      ],
      "id": "runtime.40001-registry-final-20260909.pg10",
      "image": "postgres@sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc",
      "observed": {
        "diagnostic": {
          "message_primary": "could not serialize access due to concurrent update",
          "severity": "ERROR",
          "source_file": "nodeModifyTable.c",
          "source_function": "ExecUpdate",
          "source_line": "1012",
          "sqlstate": "40001"
        },
        "final_value": 2,
        "reads": {
          "first": 0,
          "retry": 1,
          "stale": 0
        },
        "statuses": {
          "first_after_commit": "IDLE",
          "retry": "IDLE",
          "stale_after_error": "INERROR",
          "stale_after_rollback": "IDLE"
        }
      },
      "raw_sha256": "85985ffb3f1599df3bc38d65651cb2a532b329e10ab2029481733b3e8a501867",
      "run_id": "40001-registry-final-20260909",
      "server_version": "10.21 (Debian 10.21-1.pgdg90+1)",
      "server_version_num": 100021,
      "snippet_registry": {
        "sha256": "7ed0b0bf4dc0bb2a2141a1cf9b223b61d80c9817ca041355d1f6527fbbb98007"
      },
      "status": "passed",
      "summary_sha256": "45e3f031aa5d5cb02adc714c3cbfcb27e9d166bf884c6d8405559a60b840ba45",
      "target": "pg10"
    },
    {
      "cases": [
        "serializable_stale_update"
      ],
      "id": "runtime.40001-manual-boundary-final-20260909.latest",
      "observed": {
        "connections_autocommit": {
          "first": true,
          "retry": true,
          "stale": true
        },
        "diagnostic": {
          "message_primary": "could not serialize access due to concurrent update",
          "severity": "ERROR",
          "source_file": "nodeModifyTable.c",
          "source_function": "ExecUpdate",
          "source_line": "2604",
          "sqlstate": "40001"
        },
        "final_value": 2,
        "reads": {
          "first": 0,
          "retry": 1,
          "stale": 0
        },
        "retry_semantics": "Fresh retry read 1, then fixed SET value=2; this case does not test a business calculation.",
        "statuses": {
          "first_after_commit": "IDLE",
          "retry": "IDLE",
          "stale_after_error": "INERROR",
          "stale_after_rollback": "IDLE"
        },
        "transaction_control": "Registry BEGIN/COMMIT/ROLLBACK statements run with autocommit=True; no driver implicit BEGIN participates."
      },
      "raw_sha256": "befdfdf94a5577983557d64cecdd013f3e63c4e439388d1fc54e218937378b4f",
      "run_id": "40001-manual-boundary-final-20260909",
      "server_version": "18.6 (Homebrew)",
      "server_version_num": 180006,
      "snippet_registry": {
        "sha256": "7ed0b0bf4dc0bb2a2141a1cf9b223b61d80c9817ca041355d1f6527fbbb98007"
      },
      "status": "passed",
      "summary_sha256": "6bbcb014add8ea24c8b6ba7663dade8b26a6ed6b2f95f544f9c8dc11a90cbcdf",
      "target": "latest"
    },
    {
      "cases": [
        "serializable_stale_update"
      ],
      "id": "runtime.40001-manual-boundary-final-20260909.pg10",
      "image": "postgres@sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc",
      "observed": {
        "connections_autocommit": {
          "first": true,
          "retry": true,
          "stale": true
        },
        "diagnostic": {
          "message_primary": "could not serialize access due to concurrent update",
          "severity": "ERROR",
          "source_file": "nodeModifyTable.c",
          "source_function": "ExecUpdate",
          "source_line": "1012",
          "sqlstate": "40001"
        },
        "final_value": 2,
        "reads": {
          "first": 0,
          "retry": 1,
          "stale": 0
        },
        "retry_semantics": "Fresh retry read 1, then fixed SET value=2; this case does not test a business calculation.",
        "statuses": {
          "first_after_commit": "IDLE",
          "retry": "IDLE",
          "stale_after_error": "INERROR",
          "stale_after_rollback": "IDLE"
        },
        "transaction_control": "Registry BEGIN/COMMIT/ROLLBACK statements run with autocommit=True; no driver implicit BEGIN participates."
      },
      "raw_sha256": "3d761eff0e571682ef5ea48bdd8ae8c355480f8775387e667c4db707f31d715f",
      "run_id": "40001-manual-boundary-final-20260909",
      "server_version": "10.21 (Debian 10.21-1.pgdg90+1)",
      "server_version_num": 100021,
      "snippet_registry": {
        "sha256": "7ed0b0bf4dc0bb2a2141a1cf9b223b61d80c9817ca041355d1f6527fbbb98007"
      },
      "status": "passed",
      "summary_sha256": "156c4129cf0b1b6a1108cf73353cca11425dbf353c4aa695261aeb7d8db1d992",
      "target": "pg10"
    }
  ]
}
