{
  "schema": 1,
  "sqlstate": "25006",
  "condition_name": "read_only_sql_transaction",
  "runner": "scripts/verify_cases.py",
  "targets": {
    "latest": {
      "binary": "Homebrew PostgreSQL 18.6",
      "required": true
    },
    "pg10": {
      "image": "postgres:10",
      "required": true
    }
  },
  "cases": [
    {
      "id": "read_only_transaction",
      "versions": [
        "10",
        "18"
      ],
      "preconditions": [
        "A runner-owned disposable target is provisioned."
      ],
      "trigger": "Run CREATE TABLE after SET TRANSACTION READ ONLY.",
      "assertions": [
        "SQLSTATE is 25006",
        "The CREATE TABLE read-only diagnostic is exact",
        "The failed transaction is INERROR, ROLLBACK restores IDLE",
        "The table can be created after leaving read-only mode"
      ],
      "repair": "Follow the explicit transaction or source boundary described by the case.",
      "cleanup": "Drop the case schema with an owner connection."
    }
  ],
  "evidence_status": "authored",
  "snippets": [
    {
      "id": "read_only_transaction",
      "case_id": "read_only_transaction",
      "language": "sql",
      "statements": {
        "create": "CREATE TABLE items(id integer PRIMARY KEY, note text NOT NULL)",
        "begin": "BEGIN",
        "read_only": "SET TRANSACTION READ ONLY",
        "trigger": "CREATE TABLE blocked(id integer PRIMARY KEY)",
        "rollback": "ROLLBACK",
        "repair": "CREATE TABLE blocked(id integer PRIMARY KEY)",
        "verify": "SELECT count(*) FROM blocked"
      }
    }
  ],
  "runtime": [
    {
      "id": "runtime.25006-batch2-latest-20260909.latest",
      "run_id": "25006-batch2-latest-20260909",
      "target": "latest",
      "server_version": "18.6 (Homebrew)",
      "server_version_num": 180006,
      "status": "passed",
      "case_status": "passed",
      "target_status": "passed",
      "cases": [
        "read_only_transaction"
      ],
      "summary_sha256": "24fcf5d910c49c64eb3277bc4642190fe182f1ae2b731b2dffb0a5474c0189fe",
      "raw_sha256": "b506359510adfe87c3fb8dbf50ed863b7fcdaad5b6bbb7ebf910ecec38c80780",
      "case_manifest": {
        "sha256": "2009137faa2d1ebbbfa4dedfc1be073f9ea41b4bedd6c0acb34f3215ae37e25f"
      },
      "snippet_registry": {
        "sha256": "62db30e401b1f72fa50958d0ac612b2b1eb636299532dd1ad246c167e4f9fadf"
      },
      "observed": {
        "sqlstate": "25006",
        "primary": "cannot execute CREATE TABLE in a read-only transaction",
        "after_error": "INERROR",
        "after_rollback": "IDLE",
        "repair_relation": "\"c25006_read_only_transaction\".\"blocked\"",
        "final_status": "IDLE",
        "rows_after_repair": 0
      },
      "result": {
        "status": "passed",
        "environment": {
          "TimeZone": "Asia/Shanghai",
          "backend_pid": 77508,
          "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": "25006",
                "name": "read-only sqlstate",
                "observed": "25006",
                "passed": true
              },
              {
                "expected": "cannot execute CREATE TABLE in a read-only transaction",
                "name": "read-only diagnostic",
                "observed": "cannot execute CREATE TABLE in a read-only transaction",
                "passed": true
              },
              {
                "expected": "INERROR then IDLE",
                "name": "failed read-only transaction recovered",
                "observed": {
                  "after_error": "INERROR",
                  "after_rollback": "IDLE",
                  "final": "IDLE"
                },
                "passed": true
              },
              {
                "expected": "blocked exists and is empty",
                "name": "repair outside read-only transaction succeeds",
                "observed": 0,
                "passed": true
              }
            ],
            "case_id": "read_only_transaction",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.012,
            "observed": {
              "connection_autocommit": true,
              "count": 0,
              "diagnostic": {
                "column_name": null,
                "constraint_name": null,
                "context": null,
                "datatype_name": null,
                "exception_type": "ReadOnlySqlTransaction",
                "internal_position": null,
                "internal_query": null,
                "message_detail": null,
                "message_hint": null,
                "message_primary": "cannot execute CREATE TABLE in a read-only transaction",
                "schema_name": null,
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "utility.c",
                "source_function": "PreventCommandIfReadOnly",
                "source_line": "411",
                "sqlstate": "25006",
                "statement_position": null,
                "table_name": null,
                "text": "cannot execute CREATE TABLE in a read-only transaction"
              },
              "repaired_relation": "\"c25006_read_only_transaction\".\"blocked\"",
              "statuses": {
                "after_error": "INERROR",
                "after_rollback": "IDLE",
                "final": "IDLE"
              },
              "transaction_control": [
                "BEGIN",
                "SET TRANSACTION READ ONLY",
                "ROLLBACK"
              ]
            },
            "schema": "c25006_read_only_transaction",
            "status": "passed"
          }
        ]
      }
    },
    {
      "id": "runtime.25006-batch2-pg10-20260909.pg10",
      "run_id": "25006-batch2-pg10-20260909",
      "target": "pg10",
      "server_version": "10.21 (Debian 10.21-1.pgdg90+1)",
      "server_version_num": 100021,
      "status": "passed",
      "case_status": "passed",
      "target_status": "passed",
      "cases": [
        "read_only_transaction"
      ],
      "summary_sha256": "9de68a1e3ec84530fad088519fe71f009fde4dfefd02bd27e15096fb6c5b498a",
      "raw_sha256": "8aa0068ea4575ffc24bc86d329a039a63c80f5e218cad36e9e6bfa3075c8c731",
      "case_manifest": {
        "sha256": "2009137faa2d1ebbbfa4dedfc1be073f9ea41b4bedd6c0acb34f3215ae37e25f"
      },
      "snippet_registry": {
        "sha256": "62db30e401b1f72fa50958d0ac612b2b1eb636299532dd1ad246c167e4f9fadf"
      },
      "observed": {
        "sqlstate": "25006",
        "primary": "cannot execute CREATE TABLE in a read-only transaction",
        "after_error": "INERROR",
        "after_rollback": "IDLE",
        "repair_relation": "\"c25006_read_only_transaction\".\"blocked\"",
        "final_status": "IDLE",
        "rows_after_repair": 0
      },
      "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": "25006",
                "name": "read-only sqlstate",
                "observed": "25006",
                "passed": true
              },
              {
                "expected": "cannot execute CREATE TABLE in a read-only transaction",
                "name": "read-only diagnostic",
                "observed": "cannot execute CREATE TABLE in a read-only transaction",
                "passed": true
              },
              {
                "expected": "INERROR then IDLE",
                "name": "failed read-only transaction recovered",
                "observed": {
                  "after_error": "INERROR",
                  "after_rollback": "IDLE",
                  "final": "IDLE"
                },
                "passed": true
              },
              {
                "expected": "blocked exists and is empty",
                "name": "repair outside read-only transaction succeeds",
                "observed": 0,
                "passed": true
              }
            ],
            "case_id": "read_only_transaction",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.023,
            "observed": {
              "connection_autocommit": true,
              "count": 0,
              "diagnostic": {
                "column_name": null,
                "constraint_name": null,
                "context": null,
                "datatype_name": null,
                "exception_type": "ReadOnlySqlTransaction",
                "internal_position": null,
                "internal_query": null,
                "message_detail": null,
                "message_hint": null,
                "message_primary": "cannot execute CREATE TABLE in a read-only transaction",
                "schema_name": null,
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "utility.c",
                "source_function": "PreventCommandIfReadOnly",
                "source_line": "243",
                "sqlstate": "25006",
                "statement_position": null,
                "table_name": null,
                "text": "cannot execute CREATE TABLE in a read-only transaction"
              },
              "repaired_relation": "\"c25006_read_only_transaction\".\"blocked\"",
              "statuses": {
                "after_error": "INERROR",
                "after_rollback": "IDLE",
                "final": "IDLE"
              },
              "transaction_control": [
                "BEGIN",
                "SET TRANSACTION READ ONLY",
                "ROLLBACK"
              ]
            },
            "schema": "c25006_read_only_transaction",
            "status": "passed"
          }
        ]
      }
    }
  ]
}
