{
  "schema": 1,
  "sqlstate": "42P01",
  "condition_name": "undefined_table",
  "runner": "scripts/verify_cases.py",
  "targets": {
    "latest": {
      "binary": "Homebrew PostgreSQL 18.6",
      "required": true
    },
    "pg10": {
      "image": "postgres:10",
      "required": true
    }
  },
  "cases": [
    {
      "id": "missing_relation",
      "versions": [
        "10",
        "18"
      ],
      "preconditions": [
        "A disposable schema name that has no relation"
      ],
      "trigger": "Select from a relation that does not exist.",
      "assertions": [
        "SQLSTATE is 42P01",
        "The missing relation is named in the diagnostic",
        "A valid query succeeds after correcting the relation name"
      ],
      "repair": "Check schema qualification, search_path, migrations, and case-sensitive quoting before creating or renaming objects.",
      "cleanup": "Drop the case schema with an owner connection."
    }
  ],
  "evidence_status": "authored",
  "snippets": [
    {
      "id": "missing_relation",
      "case_id": "missing_relation",
      "language": "sql",
      "statements": {
        "missing": "SELECT * FROM does_not_exist",
        "create": "CREATE TABLE exists(id integer PRIMARY KEY)",
        "valid": "SELECT count(*) FROM exists"
      }
    }
  ],
  "runtime": [
    {
      "cases": [
        "missing_relation"
      ],
      "id": "runtime.42P01-registry-final-20260909.latest",
      "observed": {
        "diagnostic": {
          "message_primary": "relation \"c42p01_missing_relation.does_not_exist\" does not exist",
          "severity": "ERROR",
          "source_file": "parse_relation.c",
          "source_function": "parserOpenTable",
          "source_line": "1480",
          "sqlstate": "42P01"
        },
        "statuses": {
          "after_error": "IDLE",
          "after_valid_query": "IDLE"
        },
        "valid_count": 0
      },
      "raw_sha256": "c65e0596cb51d32791448e493b01de0bfda519bb35ed5d1153f07c156bd617ac",
      "run_id": "42P01-registry-final-20260909",
      "server_version": "18.6 (Homebrew)",
      "server_version_num": 180006,
      "snippet_registry": {
        "sha256": "f4eb28d6bc0d0d250d5dc548ed83a0783538eb73a07ab8b3670f218bcc21aba5"
      },
      "status": "passed",
      "summary_sha256": "2b61950cb5a1a8f42fe130f2ad8407cb7cbaf4dfb396481fdf88d0d5769e3e37",
      "target": "latest",
      "result": {
        "status": "passed",
        "environment": {
          "TimeZone": "Asia/Shanghai",
          "backend_pid": 28990,
          "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": "42P01",
                "name": "undefined-table sqlstate",
                "observed": "42P01",
                "passed": true
              },
              {
                "expected": "does_not_exist",
                "name": "missing relation appears in message",
                "observed": "relation \"c42p01_missing_relation.does_not_exist\" does not exist",
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "autocommit remains idle",
                "observed": {
                  "after_error": "IDLE",
                  "after_repair": "IDLE"
                },
                "passed": true
              },
              {
                "expected": "error then empty table",
                "name": "corrected relation is usable",
                "observed": {
                  "count": 0,
                  "error": true
                },
                "passed": true
              }
            ],
            "case_id": "missing_relation",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.008,
            "observed": {
              "diagnostic": {
                "column_name": null,
                "constraint_name": null,
                "context": null,
                "datatype_name": null,
                "exception_type": "UndefinedTable",
                "internal_position": null,
                "internal_query": null,
                "message_detail": null,
                "message_hint": null,
                "message_primary": "relation \"c42p01_missing_relation.does_not_exist\" does not exist",
                "schema_name": null,
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "parse_relation.c",
                "source_function": "parserOpenTable",
                "source_line": "1480",
                "sqlstate": "42P01",
                "statement_position": "15",
                "table_name": null,
                "text": "relation \"c42p01_missing_relation.does_not_exist\" does not exist\nLINE 1: SELECT * FROM \"c42p01_missing_relation\".\"does_not_exist\"\n                      ^"
              },
              "statuses": {
                "after_error": "IDLE",
                "after_valid_query": "IDLE"
              },
              "valid_count": 0
            },
            "schema": "c42p01_missing_relation",
            "status": "passed"
          }
        ]
      }
    },
    {
      "cases": [
        "missing_relation"
      ],
      "id": "runtime.42P01-registry-final-20260909.pg10",
      "image": "postgres@sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc",
      "observed": {
        "diagnostic": {
          "message_primary": "relation \"c42p01_missing_relation.does_not_exist\" does not exist",
          "severity": "ERROR",
          "source_file": "parse_relation.c",
          "source_function": "parserOpenTable",
          "source_line": "1159",
          "sqlstate": "42P01"
        },
        "statuses": {
          "after_error": "IDLE",
          "after_valid_query": "IDLE"
        },
        "valid_count": 0
      },
      "raw_sha256": "da4b4fcbbff2d04b8a03d0b7718cfe8b1954439f3bf3125cd8b79eaa88eeed79",
      "run_id": "42P01-registry-final-20260909",
      "server_version": "10.21 (Debian 10.21-1.pgdg90+1)",
      "server_version_num": 100021,
      "snippet_registry": {
        "sha256": "f4eb28d6bc0d0d250d5dc548ed83a0783538eb73a07ab8b3670f218bcc21aba5"
      },
      "status": "passed",
      "summary_sha256": "3049254a6a818ed4401abdaee428fee0f17c4d6e299a4353e880ad6fe37a38d9",
      "target": "pg10",
      "result": {
        "status": "passed",
        "environment": {
          "TimeZone": "Etc/UTC",
          "backend_pid": 79,
          "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": "42P01",
                "name": "undefined-table sqlstate",
                "observed": "42P01",
                "passed": true
              },
              {
                "expected": "does_not_exist",
                "name": "missing relation appears in message",
                "observed": "relation \"c42p01_missing_relation.does_not_exist\" does not exist",
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "autocommit remains idle",
                "observed": {
                  "after_error": "IDLE",
                  "after_repair": "IDLE"
                },
                "passed": true
              },
              {
                "expected": "error then empty table",
                "name": "corrected relation is usable",
                "observed": {
                  "count": 0,
                  "error": true
                },
                "passed": true
              }
            ],
            "case_id": "missing_relation",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.011,
            "observed": {
              "diagnostic": {
                "column_name": null,
                "constraint_name": null,
                "context": null,
                "datatype_name": null,
                "exception_type": "UndefinedTable",
                "internal_position": null,
                "internal_query": null,
                "message_detail": null,
                "message_hint": null,
                "message_primary": "relation \"c42p01_missing_relation.does_not_exist\" does not exist",
                "schema_name": null,
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "parse_relation.c",
                "source_function": "parserOpenTable",
                "source_line": "1159",
                "sqlstate": "42P01",
                "statement_position": "15",
                "table_name": null,
                "text": "relation \"c42p01_missing_relation.does_not_exist\" does not exist\nLINE 1: SELECT * FROM \"c42p01_missing_relation\".\"does_not_exist\"\n                      ^"
              },
              "statuses": {
                "after_error": "IDLE",
                "after_valid_query": "IDLE"
              },
              "valid_count": 0
            },
            "schema": "c42p01_missing_relation",
            "status": "passed"
          }
        ]
      }
    }
  ]
}
