{
  "schema": 1,
  "sqlstate": "2202E",
  "condition_name": "array_subscript_error",
  "sources": [
    {
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "id": "src.errcodes.18.6",
      "location": "lines 159-164",
      "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.array-userfuncs.18.6",
      "location": "lines 443-450, array_cat dimension checks",
      "path": "src/backend/utils/adt/array_userfuncs.c",
      "sha256": "dc14f95e12c92360f8b10c7546d8af4a0b41a6a0431efc2a4f5b236155eadb50",
      "tag": "REL_18_6",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/array_userfuncs.c#L443-L450"
    },
    {
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "id": "src.arrayfuncs.18.6",
      "location": "lines 2644-2653, 2881-2888, 2976-2990, 3008-3017",
      "path": "src/backend/utils/adt/arrayfuncs.c",
      "sha256": "1f1c9dab1e5f8c936bbfe6c28a3011365b433367e1854166bbec9d2e97341177",
      "tag": "REL_18_6",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/arrayfuncs.c#L2644-L2653"
    },
    {
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "id": "src.exec-expr.18.6",
      "location": "lines 3549-3565, multidimensional constructor checks",
      "path": "src/backend/executor/execExprInterp.c",
      "sha256": "05cbc1cdfd1d091b02045ee55b37147f69be8f0fcb23274751820cc09db33564",
      "tag": "REL_18_6",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/executor/execExprInterp.c#L3549-L3565"
    },
    {
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "id": "doc.array.18",
      "location": "lines 302-321, 403-437, array subscript, slice, and assignment behavior",
      "path": "doc/src/sgml/array.sgml",
      "sha256": "a432afb453ba3e4fc99b3b8055794fbd1f1d2980a85b14933ea8bae285dc6ab4",
      "tag": "PG18-docs",
      "url": "https://www.postgresql.org/docs/18/arrays.html"
    },
    {
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "id": "doc.func.18",
      "location": "lines 20487-20586 and 20810-20842, array metadata functions",
      "path": "doc/src/sgml/func.sgml",
      "sha256": "05d03f505dc3c3b4fb2b3a6e8ed3275c425306a8ff20dd9548e838c26bbb968a",
      "tag": "PG18-docs",
      "url": "https://www.postgresql.org/docs/18/functions-array.html"
    },
    {
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "id": "doc.transactions.18",
      "location": "transaction rollback and savepoint behavior",
      "path": "doc/src/sgml/xact.sgml",
      "sha256": "b48fbe8bd02ce3d1181a350c88c8baa6e11c73edc90a936e77b180daef328c5c",
      "tag": "PG18-docs",
      "url": "https://www.postgresql.org/docs/18/tutorial-transactions.html"
    },
    {
      "commit": "313a720f95a3f41b59f853786b184f38f82172d9",
      "id": "doc.errcodes.8.1.4",
      "kind": "upstream_source",
      "location": "REL8_1_4 table rows 305-307",
      "path": "doc/src/sgml/errcodes.sgml",
      "release": "8.1.4",
      "sha256": "fdd6f5470b19970d3b60219a44e66b33193647975d346adfe2a98178f706b776",
      "url": "https://github.com/postgres/postgres/blob/313a720f95a3f41b59f853786b184f38f82172d9/doc/src/sgml/errcodes.sgml#L305-L307"
    },
    {
      "id": "manifest.2202E",
      "kind": "local_artifact",
      "location": "snapshots and definition_blobs entries for the 2202E definition",
      "sha256": "1727a275f336988ff96b4f9990a4ca253080f73fc5d316e7def165c8cf3708a8"
    },
    {
      "id": "case-manifest.2202E",
      "kind": "local_artifact",
      "location": "incompatible_array_dimensions",
      "sha256": "1d2e960bba60d3df05073ce8e34d185de91f991687256ba49c6840d5d196ff2a"
    },
    {
      "id": "snippet-registry.2202E.final",
      "kind": "local_artifact",
      "location": "incompatible_array_dimensions ordered trigger and followup",
      "sha256": "f32e131d29c29543cba59be6ac16cc8cdee8d6ac684ff60dec4f58063d0f6e77"
    }
  ],
  "claims": [
    {
      "id": "identity.class-and-condition",
      "limits": "The directory identifies the condition but does not imply that every array read outside bounds raises it.",
      "method": "Read the Class 22 section and the named 2202E row in the frozen errcodes.txt snapshot.",
      "sources": [
        "src.errcodes.18.6"
      ],
      "statement": "2202E is the array_subscript_error condition in Class 22, Data Exception."
    },
    {
      "id": "identity.alias-macro",
      "limits": "The alias is a source-level name; the wire value remains the five-character SQLSTATE.",
      "method": "Read the adjacent alias and named macro rows and the SQL99 explanatory comment.",
      "sources": [
        "src.errcodes.18.6"
      ],
      "statement": "ERRCODE_ARRAY_ELEMENT_ERROR is retained as an alias for the same 2202E SQLSTATE; ERRCODE_ARRAY_SUBSCRIPT_ERROR carries the array_subscript_error condition name."
    },
    {
      "id": "array.read-outside-bounds",
      "limits": "This claim applies to reads; assignment, slice validation, construction, and concatenation have separate rules.",
      "method": "Read the official array subscript expression rules and examples.",
      "sources": [
        "doc.array.18"
      ],
      "statement": "An array element read outside the current bounds, or a read with the wrong number of subscripts, returns NULL rather than raising an error."
    },
    {
      "id": "array.slice-rules",
      "limits": "The result also depends on NULL array or subscript expressions; it is not evidence of a 2202E error.",
      "method": "Read the documented slice behavior immediately following the element subscript rules.",
      "sources": [
        "doc.array.18"
      ],
      "statement": "A slice completely outside the current bounds can yield an empty zero-dimensional array, while a partially overlapping slice is reduced to the overlap."
    },
    {
      "id": "array.assignment-rules",
      "limits": "Whether a particular assignment raises 2202E depends on the array value, dimensions, and exact operation.",
      "method": "Read the official assignment rules and the fixed arrayfuncs validation branches.",
      "sources": [
        "doc.array.18",
        "src.arrayfuncs.18.6"
      ],
      "statement": "One-dimensional subscript assignment can enlarge an array and fill intervening positions with NULL; multidimensional enlargement is not supported, and empty-array slice assignment requires both boundaries."
    },
    {
      "id": "mechanism.concat-dimensions",
      "limits": "The primary and detail templates are specific to this concatenation path.",
      "method": "Trace the dimension and lower-bound comparison into the errcode and primary/detail construction in array_cat().",
      "sources": [
        "src.array-userfuncs.18.6"
      ],
      "statement": "array_cat raises 2202E when equal-rank arrays have differing non-concatenated dimensions or lower bounds."
    },
    {
      "id": "mechanism.multidimensional-construction",
      "limits": "This source path is separate from array_cat and has a different message template.",
      "method": "Read the multidimensional array constructor check and its ERRCODE_ARRAY_SUBSCRIPT_ERROR ereport.",
      "sources": [
        "src.exec-expr.18.6"
      ],
      "statement": "The expression evaluator raises 2202E when non-empty array expressions used to form a multidimensional array have incompatible dimensions."
    },
    {
      "id": "diagnosis.metadata-functions",
      "limits": "Inspection functions describe the value supplied to them; they do not predict every coercion or operator resolution step.",
      "method": "Read the PostgreSQL 18 array function table entries.",
      "sources": [
        "doc.func.18"
      ],
      "statement": "array_ndims, array_dims, array_lower, array_upper, and cardinality expose the rank, dimensions, bounds, and item count needed to inspect an array operation."
    },
    {
      "id": "runtime.concat-case",
      "limits": "The run is an autocommit concatenation case; it does not test every assignment, slice, constructor, or explicit-transaction path.",
      "method": "Read the stable case and ordered snippet registry, then compare the case_result diagnostics and status in both final target summaries and raw records.",
      "sources": [
        "case-manifest.2202E",
        "snippet-registry.2202E.final",
        "runtime.2202E-snippet-registry-final-20260909.latest",
        "runtime.2202E-snippet-registry-final-20260909.pg10"
      ],
      "statement": "The incompatible_array_dimensions case returned 2202E with the incompatible concatenation diagnostic and then successfully executed a valid concatenation on the same connection."
    },
    {
      "id": "runtime.transaction-boundary",
      "limits": "No explicit transaction or PL/pgSQL exception handler was executed in this 2202E case.",
      "method": "Read the transaction contract and the status/valid-array observations in both runner summaries.",
      "sources": [
        "doc.transactions.18",
        "runtime.2202E-snippet-registry-final-20260909.latest",
        "runtime.2202E-snippet-registry-final-20260909.pg10"
      ],
      "statement": "The representative 2202E ERROR left the autocommit connection IDLE and the follow-up valid statement succeeded; explicit transaction and PL/pgSQL handler outcomes must be handled at their own boundaries."
    },
    {
      "id": "versions.catalogue-boundary",
      "limits": "The pre-9.0 source set is locked through 8.4.22 but candidate source gaps remain for 7.0–7.3; observed presence is not an asserted introduction version.",
      "method": "Read the manifest snapshot and the same-tag REL8_1_4 errcodes.sgml row for the code; the generated data record is a derived view.",
      "sources": [
        "manifest.2202E",
        "doc.errcodes.8.1.4"
      ],
      "statement": "The locked catalogue records 2202E in the 7.4–8.4.22 pre-9.0 formal sources, every listed formal snapshot from 9.0.23 through 18.6, and 19beta3. The same-tag REL8_1_4 errcodes.sgml row already lists 2202E as array_subscript_error, confirming that condition-name observation by 8.1.4. Candidate source gaps remain for 7.0–7.3, so 7.4 is a presence boundary rather than an exact introduction version."
    }
  ],
  "messages": [
    {
      "detail_template": "Arrays with differing element dimensions are not compatible for concatenation.",
      "id": "message.concat",
      "limits": "The template belongs to array_cat; runtime source lines are 450 on 18.6 and 356 on 10.21.",
      "primary_template": "cannot concatenate incompatible arrays",
      "severity_source": "explicit ERROR with ERRCODE_ARRAY_SUBSCRIPT_ERROR",
      "sources": [
        "src.array-userfuncs.18.6",
        "runtime.2202E-snippet-registry-final-20260909.latest",
        "runtime.2202E-snippet-registry-final-20260909.pg10"
      ],
      "sqlstate": "2202E"
    },
    {
      "id": "message.subscript",
      "limits": "This template is emitted by validated assignment/slice paths; a plain out-of-bounds read is documented to return NULL.",
      "primary_template": "array subscript out of range",
      "severity_source": "explicit ERROR with ERRCODE_ARRAY_SUBSCRIPT_ERROR",
      "sources": [
        "src.arrayfuncs.18.6"
      ],
      "sqlstate": "2202E"
    },
    {
      "detail_template": "When assigning to a slice of an empty array value, slice boundaries must be fully specified.",
      "id": "message.slice-boundaries",
      "limits": "This is the empty-array slice assignment path and is not a general read diagnostic.",
      "primary_template": "array slice subscript must provide both boundaries",
      "severity_source": "explicit ERROR with ERRCODE_ARRAY_SUBSCRIPT_ERROR",
      "sources": [
        "src.arrayfuncs.18.6"
      ],
      "sqlstate": "2202E"
    },
    {
      "id": "message.bound-order",
      "limits": "This template is emitted by the slice boundary validation branch.",
      "primary_template": "upper bound cannot be less than lower bound",
      "severity_source": "explicit ERROR with ERRCODE_ARRAY_SUBSCRIPT_ERROR",
      "sources": [
        "src.arrayfuncs.18.6"
      ],
      "sqlstate": "2202E"
    }
  ],
  "usage_evidence": [
    {
      "evidence_ids": [
        "identity.class-and-condition",
        "identity.alias-macro",
        "src.errcodes.18.6"
      ],
      "scope": "directory_definition_and_alias",
      "status": "definition_only"
    },
    {
      "evidence_ids": [
        "array.read-outside-bounds",
        "array.slice-rules",
        "doc.array.18"
      ],
      "scope": "array_read_and_slice_semantics",
      "status": "source_path_confirmed"
    },
    {
      "evidence_ids": [
        "array.assignment-rules",
        "message.subscript",
        "message.slice-boundaries",
        "src.arrayfuncs.18.6"
      ],
      "scope": "assignment_validation",
      "status": "source_path_confirmed"
    },
    {
      "evidence_ids": [
        "mechanism.concat-dimensions",
        "mechanism.multidimensional-construction",
        "src.array-userfuncs.18.6",
        "src.exec-expr.18.6"
      ],
      "scope": "concatenation_and_constructor",
      "status": "source_path_confirmed"
    },
    {
      "evidence_ids": [
        "runtime.concat-case",
        "snippet-registry.2202E.final",
        "runtime.2202E-snippet-registry-final-20260909.latest",
        "runtime.2202E-snippet-registry-final-20260909.pg10"
      ],
      "scope": "representative_runtime",
      "status": "observed_runtime"
    },
    {
      "evidence_ids": [
        "versions.catalogue-boundary",
        "manifest.2202E",
        "doc.errcodes.8.1.4"
      ],
      "scope": "version_presence",
      "status": "definition_only"
    }
  ],
  "runtime": [
    {
      "cases": [
        "incompatible_array_dimensions"
      ],
      "id": "runtime.2202E-snippet-registry-final-20260909.latest",
      "observed": {
        "message_detail": "Arrays with differing element dimensions are not compatible for concatenation.",
        "message_primary": "cannot concatenate incompatible arrays",
        "severity": "ERROR",
        "source_file": "array_userfuncs.c",
        "source_function": "array_cat",
        "source_line": "450",
        "sqlstate": "2202E",
        "status_after_error": "IDLE",
        "valid_array": [
          1,
          2,
          3,
          4
        ]
      },
      "raw_sha256": "79794b2a9728ec77920b27613121b6697077f2d8820b3f1b0bc66c2d049bcb6f",
      "run_id": "2202E-snippet-registry-final-20260909",
      "server_version": "18.6 (Homebrew)",
      "server_version_num": 180006,
      "snippet_registry": {
        "sha256": "f32e131d29c29543cba59be6ac16cc8cdee8d6ac684ff60dec4f58063d0f6e77"
      },
      "status": "passed",
      "summary_sha256": "78a2515555554f99aadfd8586ad58949f2744323e13a71960143da42ee1cc5a3",
      "target": "latest"
    },
    {
      "cases": [
        "incompatible_array_dimensions"
      ],
      "id": "runtime.2202E-snippet-registry-final-20260909.pg10",
      "image": "postgres@sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc",
      "observed": {
        "message_detail": "Arrays with differing element dimensions are not compatible for concatenation.",
        "message_primary": "cannot concatenate incompatible arrays",
        "severity": "ERROR",
        "source_file": "array_userfuncs.c",
        "source_function": "array_cat",
        "source_line": "356",
        "sqlstate": "2202E",
        "status_after_error": "IDLE",
        "valid_array": [
          1,
          2,
          3,
          4
        ]
      },
      "raw_sha256": "1b6eeb7b7abffd57d9d470d3639df04e7b49affacd25a24cb35e423fcc8d037d",
      "run_id": "2202E-snippet-registry-final-20260909",
      "server_version": "10.21 (Debian 10.21-1.pgdg90+1)",
      "server_version_num": 100021,
      "snippet_registry": {
        "sha256": "f32e131d29c29543cba59be6ac16cc8cdee8d6ac684ff60dec4f58063d0f6e77"
      },
      "status": "passed",
      "summary_sha256": "db9c312891f485e36a017684ba802d9fa6c9ab1508c4b0be292165e3a24fb8d8",
      "target": "pg10"
    }
  ]
}
