{
  "schema": 1,
  "sqlstate": "22P03",
  "condition_name": "invalid_binary_representation",
  "sources": [
    {
      "id": "src.errcodes.18.6",
      "kind": "upstream_source",
      "source_role": "condition_definition",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/utils/errcodes.txt",
      "sha256": "6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt#L207",
      "lines": "207"
    },
    {
      "id": "src.path.copy-binary",
      "kind": "upstream_source",
      "source_role": "resolved_report_context",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/commands/copyfromparse.c",
      "sha256": "bc42754023579cd782a3cb3f144ad2c2c3d3aa46119eb7567fcdb05f2d445571",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/commands/copyfromparse.c#L2047",
      "lines": "2047-2055"
    },
    {
      "id": "src.path.bind",
      "kind": "upstream_source",
      "source_role": "resolved_report_context",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/tcop/postgres.c",
      "sha256": "9fb62275b1badf94d01ab351337b60410cd9b3ab1fe63fa9f23d6d2185a21061",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/tcop/postgres.c#L1922",
      "lines": "1922-1945"
    },
    {
      "id": "src.path.fastpath",
      "kind": "upstream_source",
      "source_role": "resolved_report_context",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/tcop/fastpath.c",
      "sha256": "c42985c83293efe0bdf1c265930e0d4e13d6bb2eb23040815e638ad9244eab6c",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/tcop/fastpath.c#L426",
      "lines": "426-448"
    },
    {
      "id": "src.path.logicalrep",
      "kind": "upstream_source",
      "source_role": "resolved_report_context",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/replication/logical/worker.c",
      "sha256": "096c5c46ffee6aab907ec5dad467100c5e3e8a4d398332d62dd302ab9c2ebf18",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/replication/logical/worker.c#L832",
      "lines": "832-853"
    },
    {
      "id": "src.path.array",
      "kind": "upstream_source",
      "source_role": "resolved_report_context",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/utils/adt/arrayfuncs.c",
      "sha256": "1f1c9dab1e5f8c936bbfe6c28a3011365b433367e1854166bbec9d2e97341177",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/arrayfuncs.c#L1296",
      "lines": "1296-1312"
    },
    {
      "id": "src.path.array-elements",
      "kind": "upstream_source",
      "source_role": "resolved_report_context",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/utils/adt/arrayfuncs.c",
      "sha256": "1f1c9dab1e5f8c936bbfe6c28a3011365b433367e1854166bbec9d2e97341177",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/arrayfuncs.c#L1476",
      "lines": "1476-1510"
    },
    {
      "id": "src.path.numeric",
      "kind": "upstream_source",
      "source_role": "resolved_report_context",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/utils/adt/numeric.c",
      "sha256": "6cde7cd60b3330b83be35d1f014045f5fb5fe737f3c5db4c8ed4080b99f2b666",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/numeric.c#L1093",
      "lines": "1093-1123"
    },
    {
      "id": "src.path.protocol-recovery",
      "kind": "upstream_source",
      "source_role": "resolved_report_context",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/tcop/postgres.c",
      "sha256": "9fb62275b1badf94d01ab351337b60410cd9b3ab1fe63fa9f23d6d2185a21061",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/tcop/postgres.c#L4483",
      "lines": "4483-4504"
    },
    {
      "id": "src.path.fastpath-dispatch",
      "kind": "upstream_source",
      "source_role": "resolved_report_context",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/tcop/postgres.c",
      "sha256": "9fb62275b1badf94d01ab351337b60410cd9b3ab1fe63fa9f23d6d2185a21061",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/tcop/postgres.c#L4843",
      "lines": "4843-4875"
    },
    {
      "id": "src.path.protocol-flags",
      "kind": "upstream_source",
      "source_role": "protocol_flow",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/tcop/postgres.c",
      "sha256": "9fb62275b1badf94d01ab351337b60410cd9b3ab1fe63fa9f23d6d2185a21061",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/tcop/postgres.c#L416-L445",
      "lines": "416-445"
    },
    {
      "id": "doc.protocol.copy",
      "kind": "upstream_source",
      "source_role": "official_documentation",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "doc/src/sgml/protocol.sgml",
      "sha256": "745339e07ebbc2bb67d98b258e25772ada644ef26011e3cd6b3fcbb435235f89",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/protocol.sgml#L1287-L1318",
      "lines": "1287-1318",
      "docs_url": "https://www.postgresql.org/docs/18/protocol.html"
    },
    {
      "id": "doc.protocol.status",
      "kind": "upstream_source",
      "source_role": "official_documentation",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "doc/src/sgml/protocol.sgml",
      "sha256": "745339e07ebbc2bb67d98b258e25772ada644ef26011e3cd6b3fcbb435235f89",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/protocol.sgml#L7821-L7823",
      "lines": "7821-7823",
      "docs_url": "https://www.postgresql.org/docs/18/protocol.html"
    }
  ],
  "claims": [
    {
      "id": "identity",
      "statement": "22P03 is invalid_binary_representation in SQLSTATE Class 22.",
      "sources": [
        "src.errcodes.18.6"
      ],
      "method": "Read fixed definition."
    },
    {
      "id": "protocol-and-copy",
      "statement": "Binary COPY and extended-protocol Bind call a type receive function and reject leftover bytes after the receiver returns; COPY uses the unqualified primary and Bind names the parameter number. The frontend loop marks Bind/Parse for skip-until-Sync recovery, while FunctionCall and COPY data are not marked by that extended-query flag. The protocol documentation distinguishes extended-query COPY (ErrorResponse, then Sync and ReadyForQuery) from simple Query COPY (discard the rest of the query and send ReadyForQuery without Sync); ReadyForQuery reports status but does not itself clear an aborted transaction. A separate protocol-synchronization loss path is FATAL.",
      "sources": [
        "src.path.copy-binary",
        "src.path.bind",
        "src.path.protocol-flags",
        "src.path.protocol-recovery",
        "src.path.fastpath-dispatch",
        "doc.protocol.copy",
        "doc.protocol.status"
      ],
      "method": "Read the complete receive-and-cursor guards."
    },
    {
      "id": "fastpath-and-replication",
      "statement": "Fast-path arguments and logical-replication binary columns use the same consume-the-whole-buffer guard, with argument or remote-column context in the primary. Logical replication resets the StringInfo cursor before receive because some paths reparse the tuple.",
      "sources": [
        "src.path.fastpath",
        "src.path.logicalrep"
      ],
      "method": "Read the complete binary branches and cursor reset/leftover checks."
    },
    {
      "id": "type-receivers",
      "statement": "Built-in binary receive functions can emit 22P03 for invalid internal layouts, including array dimensions/flags/element framing and numeric sign/scale/digit fields.",
      "sources": [
        "src.path.array",
        "src.path.array-elements",
        "src.path.numeric"
      ],
      "method": "Read representative type receive guards.",
      "limits": "The listed type paths are representative, not an exhaustive inventory of all receive functions."
    },
    {
      "id": "history",
      "statement": "The locked catalogue records 22P03 from 7.4; that boundary does not prove exact implementation introduction.",
      "sources": [
        "src.errcodes.18.6"
      ],
      "method": "Use catalogue boundary."
    }
  ],
  "messages": [
    {
      "id": "message.copy",
      "sqlstate": "22P03",
      "primary_template": "incorrect binary data format",
      "severity_source": "ERROR",
      "sources": [
        "src.path.copy-binary"
      ]
    },
    {
      "id": "message.bind",
      "sqlstate": "22P03",
      "primary_template": "incorrect binary data format in bind parameter %d",
      "severity_source": "ERROR",
      "sources": [
        "src.path.bind"
      ]
    },
    {
      "id": "message.fastpath",
      "sqlstate": "22P03",
      "primary_template": "incorrect binary data format in function argument %d",
      "severity_source": "ERROR",
      "sources": [
        "src.path.fastpath"
      ]
    },
    {
      "id": "message.logicalrep",
      "sqlstate": "22P03",
      "primary_template": "incorrect binary data format in logical replication column %d",
      "severity_source": "ERROR",
      "sources": [
        "src.path.logicalrep"
      ]
    },
    {
      "id": "message.array-dim",
      "sqlstate": "22P03",
      "primary_template": "invalid number of dimensions: %d",
      "severity_source": "ERROR",
      "sources": [
        "src.path.array"
      ]
    },
    {
      "id": "message.array-flags",
      "sqlstate": "22P03",
      "primary_template": "invalid array flags",
      "severity_source": "ERROR",
      "sources": [
        "src.path.array"
      ]
    },
    {
      "id": "message.array-data",
      "sqlstate": "22P03",
      "primary_template": "insufficient data left in message",
      "severity_source": "ERROR",
      "sources": [
        "src.path.array-elements"
      ]
    },
    {
      "id": "message.array-element",
      "sqlstate": "22P03",
      "primary_template": "improper binary format in array element %d",
      "severity_source": "ERROR",
      "sources": [
        "src.path.array-elements"
      ]
    },
    {
      "id": "message.numeric-sign",
      "sqlstate": "22P03",
      "primary_template": "invalid sign in external \"numeric\" value",
      "severity_source": "ERROR",
      "sources": [
        "src.path.numeric"
      ]
    },
    {
      "id": "message.numeric-scale",
      "sqlstate": "22P03",
      "primary_template": "invalid scale in external \"numeric\" value",
      "severity_source": "ERROR",
      "sources": [
        "src.path.numeric"
      ]
    },
    {
      "id": "message.numeric-digit",
      "sqlstate": "22P03",
      "primary_template": "invalid digit in external \"numeric\" value",
      "severity_source": "ERROR",
      "sources": [
        "src.path.numeric"
      ]
    }
  ],
  "usage_evidence": [
    {
      "scope": "definition",
      "status": "definition_only",
      "evidence_ids": [
        "identity"
      ]
    },
    {
      "scope": "fixed-source-path",
      "status": "source_path_confirmed",
      "evidence_ids": [
        "protocol-and-copy",
        "fastpath-and-replication",
        "type-receivers"
      ]
    },
    {
      "scope": "history",
      "status": "unknown",
      "evidence_ids": [
        "history"
      ]
    },
    {
      "scope": "natural-runtime",
      "status": "unknown",
      "evidence_ids": [
        "protocol-and-copy",
        "fastpath-and-replication",
        "type-receivers"
      ]
    }
  ],
  "runtime": []
}
