{
  "schema": 1,
  "sqlstate": "2202E",
  "condition_name": "array_subscript_error",
  "runner": "scripts/verify_cases.py",
  "targets": {
    "latest": {
      "binary": "Homebrew PostgreSQL 18.6",
      "required": true
    },
    "pg10": {
      "image": "postgres:10",
      "required": true
    }
  },
  "cases": [
    {
      "id": "incompatible_array_dimensions",
      "versions": [
        "10",
        "18"
      ],
      "preconditions": [
        "A dedicated autocommit connection"
      ],
      "trigger": "Concatenate two arrays whose element dimensions are incompatible.",
      "assertions": [
        "SQLSTATE is 2202E",
        "The diagnostic explains the incompatible dimensions",
        "A valid array operation succeeds afterward"
      ],
      "repair": "Validate rank, bounds, and element dimensions before concatenation or assignment.",
      "cleanup": "Drop the case schema with an owner connection."
    }
  ],
  "evidence_status": "authored",
  "snippets": [
    {
      "id": "incompatible_array_dimensions",
      "case_id": "incompatible_array_dimensions",
      "language": "sql",
      "statements": {
        "trigger": "SELECT ARRAY[[1,2]] || ARRAY[[3]]",
        "valid": "SELECT ARRAY[1,2] || ARRAY[3,4]"
      }
    }
  ],
  "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",
      "result": {
        "status": "passed",
        "environment": {
          "TimeZone": "Asia/Shanghai",
          "backend_pid": 11238,
          "binary": {
            "bindir": "/opt/homebrew/Cellar/postgresql@18/18.6/bin",
            "pg_config": "/opt/homebrew/bin/pg_config",
            "pg_config_version": "PostgreSQL 18.6 (Homebrew)",
            "postgres": "/opt/homebrew/Cellar/postgresql@18/18.6/bin/postgres"
          },
          "connection_scope": "runner-owned localhost port",
          "current_user": "runner",
          "docker": {},
          "lc_messages": "C",
          "libpq_version": "18.6",
          "locale": "en_US.UTF-8",
          "log_destination": "csvlog,jsonlog",
          "log_error_verbosity": "verbose",
          "log_min_error_statement": "error",
          "log_min_messages": "error",
          "logging_collector": "on",
          "machine": "arm64",
          "max_connections": "100",
          "platform": "macOS-26.6.2-arm64-arm-64bit-Mach-O",
          "psycopg_version": "3.3.5",
          "python_version": "3.14.6 (main, Jun 10 2026, 10:03:53) [Clang 21.0.0 (clang-2100.0.123.102)]",
          "server_encoding": "UTF8",
          "server_version": "18.6 (Homebrew)",
          "server_version_num": "180006",
          "target_kind": "latest",
          "wal_level": "logical"
        },
        "cases": [
          {
            "assertions": [
              {
                "expected": "2202E",
                "name": "array-subscript sqlstate",
                "observed": "2202E",
                "passed": true
              },
              {
                "expected": "incompatible arrays",
                "name": "array dimension detail",
                "observed": "cannot concatenate incompatible arrays",
                "passed": true
              },
              {
                "expected": "error, IDLE, {1,2,3,4}",
                "name": "connection remains usable",
                "observed": {
                  "error": true,
                  "status": "IDLE",
                  "valid": [
                    1,
                    2,
                    3,
                    4
                  ]
                },
                "passed": true
              }
            ],
            "case_id": "incompatible_array_dimensions",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.01,
            "observed": {
              "diagnostic": {
                "column_name": null,
                "constraint_name": null,
                "context": null,
                "datatype_name": null,
                "exception_type": "ArraySubscriptError",
                "internal_position": null,
                "internal_query": null,
                "message_detail": "Arrays with differing element dimensions are not compatible for concatenation.",
                "message_hint": null,
                "message_primary": "cannot concatenate incompatible arrays",
                "schema_name": null,
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "array_userfuncs.c",
                "source_function": "array_cat",
                "source_line": "450",
                "sqlstate": "2202E",
                "statement_position": null,
                "table_name": null,
                "text": "cannot concatenate incompatible arrays\nDETAIL:  Arrays with differing element dimensions are not compatible for concatenation."
              },
              "status": "IDLE",
              "valid_array": [
                1,
                2,
                3,
                4
              ]
            },
            "schema": "c2202e_incompatible_array_dimensions",
            "status": "passed"
          }
        ]
      }
    },
    {
      "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",
      "result": {
        "status": "passed",
        "environment": {
          "TimeZone": "Etc/UTC",
          "backend_pid": 80,
          "binary": {},
          "connection_scope": "runner-owned localhost port",
          "current_user": "postgres",
          "docker": {
            "architecture": "arm64",
            "command": "/usr/local/bin/docker",
            "id": "sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc",
            "image": "postgres:10",
            "image_created": "2022-06-23T09:11:18.374607054Z",
            "os": "linux",
            "repo_digests": [
              "postgres@sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc"
            ]
          },
          "lc_messages": "en_US.utf8",
          "libpq_version": "18.6",
          "locale": "en_US.UTF-8",
          "log_destination": "csvlog",
          "log_error_verbosity": "verbose",
          "log_min_error_statement": "error",
          "log_min_messages": "error",
          "logging_collector": "on",
          "machine": "arm64",
          "max_connections": "100",
          "platform": "macOS-26.6.2-arm64-arm-64bit-Mach-O",
          "psycopg_version": "3.3.5",
          "python_version": "3.14.6 (main, Jun 10 2026, 10:03:53) [Clang 21.0.0 (clang-2100.0.123.102)]",
          "server_encoding": "UTF8",
          "server_version": "10.21 (Debian 10.21-1.pgdg90+1)",
          "server_version_num": "100021",
          "target_kind": "pg10",
          "wal_level": "logical"
        },
        "cases": [
          {
            "assertions": [
              {
                "expected": "2202E",
                "name": "array-subscript sqlstate",
                "observed": "2202E",
                "passed": true
              },
              {
                "expected": "incompatible arrays",
                "name": "array dimension detail",
                "observed": "cannot concatenate incompatible arrays",
                "passed": true
              },
              {
                "expected": "error, IDLE, {1,2,3,4}",
                "name": "connection remains usable",
                "observed": {
                  "error": true,
                  "status": "IDLE",
                  "valid": [
                    1,
                    2,
                    3,
                    4
                  ]
                },
                "passed": true
              }
            ],
            "case_id": "incompatible_array_dimensions",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.017,
            "observed": {
              "diagnostic": {
                "column_name": null,
                "constraint_name": null,
                "context": null,
                "datatype_name": null,
                "exception_type": "ArraySubscriptError",
                "internal_position": null,
                "internal_query": null,
                "message_detail": "Arrays with differing element dimensions are not compatible for concatenation.",
                "message_hint": null,
                "message_primary": "cannot concatenate incompatible arrays",
                "schema_name": null,
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "array_userfuncs.c",
                "source_function": "array_cat",
                "source_line": "356",
                "sqlstate": "2202E",
                "statement_position": null,
                "table_name": null,
                "text": "cannot concatenate incompatible arrays\nDETAIL:  Arrays with differing element dimensions are not compatible for concatenation."
              },
              "status": "IDLE",
              "valid_array": [
                1,
                2,
                3,
                4
              ]
            },
            "schema": "c2202e_incompatible_array_dimensions",
            "status": "passed"
          }
        ]
      }
    }
  ]
}
