{
  "schema": 1,
  "sqlstate": "25P01",
  "condition_name": "no_active_sql_transaction",
  "runner": "scripts/verify_cases.py",
  "targets": {
    "latest": {
      "binary": "Homebrew PostgreSQL 18.6",
      "required": true
    },
    "pg10": {
      "image": "postgres:10",
      "required": true
    }
  },
  "cases": [
    {
      "id": "savepoint_without_transaction",
      "versions": [
        "10",
        "18"
      ],
      "preconditions": [
        "A runner-owned disposable target is provisioned."
      ],
      "trigger": "Run SAVEPOINT without BEGIN, then repeat inside an explicit block.",
      "assertions": [
        "SQLSTATE is 25P01",
        "SAVEPOINT outside a block reports the no-active-transaction message",
        "An explicit BEGIN/SAVEPOINT/RELEASE/COMMIT repair succeeds"
      ],
      "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": "no_active_sql_transaction",
      "case_id": "savepoint_without_transaction",
      "language": "sql",
      "statements": {
        "trigger": "SAVEPOINT outside_block",
        "begin": "BEGIN",
        "savepoint": "SAVEPOINT inside_block",
        "release": "RELEASE SAVEPOINT inside_block",
        "commit": "COMMIT",
        "verify": "SELECT 1"
      }
    }
  ],
  "runtime": [
    {
      "id": "runtime.25P01-batch2-latest-20260909.latest",
      "run_id": "25P01-batch2-latest-20260909",
      "target": "latest",
      "server_version": "18.6 (Homebrew)",
      "server_version_num": 180006,
      "status": "passed",
      "case_status": "passed",
      "target_status": "passed",
      "cases": [
        "savepoint_without_transaction"
      ],
      "summary_sha256": "aa6294daccf84497125a2e823231f2f7f7c3909d16064761ae4e8d4783376027",
      "raw_sha256": "4bd89117ee074c9e6d7bc8fb0023b2dbea6cc2389c3e6956a4074b161ef0887a",
      "case_manifest": {
        "sha256": "49bc7e60ade603e07255a3096b94803423aa3a2fbd058a3aca604d4edfaf0072"
      },
      "snippet_registry": {
        "sha256": "a1ffffc778f82789f1c1ac4027a109fc76e4b315ef2e3a5bdbfc47c8f84ce951"
      },
      "observed": {
        "sqlstate": "25P01",
        "primary": "SAVEPOINT can only be used in transaction blocks",
        "after_error": "IDLE",
        "after_begin": "INTRANS",
        "final_status": "IDLE"
      },
      "result": {
        "status": "passed",
        "environment": {
          "TimeZone": "Asia/Shanghai",
          "backend_pid": 77590,
          "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": "25P01",
                "name": "no-active-transaction sqlstate",
                "observed": "25P01",
                "passed": true
              },
              {
                "expected": "SAVEPOINT can only be used in transaction blocks",
                "name": "savepoint requires transaction block",
                "observed": "SAVEPOINT can only be used in transaction blocks",
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "autocommit error stays idle",
                "observed": "IDLE",
                "passed": true
              },
              {
                "expected": "SAVEPOINT/RELEASE/COMMIT and IDLE",
                "name": "explicit transaction repair succeeds",
                "observed": {
                  "begin": "INTRANS",
                  "final": "IDLE",
                  "result": 1
                },
                "passed": true
              }
            ],
            "case_id": "savepoint_without_transaction",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.007,
            "observed": {
              "connection_autocommit": true,
              "diagnostic": {
                "column_name": null,
                "constraint_name": null,
                "context": null,
                "datatype_name": null,
                "exception_type": "NoActiveSqlTransaction",
                "internal_position": null,
                "internal_query": null,
                "message_detail": null,
                "message_hint": null,
                "message_primary": "SAVEPOINT can only be used in transaction blocks",
                "schema_name": null,
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "xact.c",
                "source_function": "CheckTransactionBlock",
                "source_line": "3749",
                "sqlstate": "25P01",
                "statement_position": null,
                "table_name": null,
                "text": "SAVEPOINT can only be used in transaction blocks"
              },
              "statuses": {
                "after_begin": "INTRANS",
                "after_error": "IDLE",
                "final": "IDLE"
              },
              "transaction_control": [
                "BEGIN",
                "SAVEPOINT",
                "RELEASE SAVEPOINT",
                "COMMIT"
              ]
            },
            "schema": "c25p01_savepoint_without_transaction",
            "status": "passed"
          }
        ]
      }
    },
    {
      "id": "runtime.25P01-batch2-pg10-20260909.pg10",
      "run_id": "25P01-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": [
        "savepoint_without_transaction"
      ],
      "summary_sha256": "daa3bbb7722b859f4b759e3a8421138b6e5a38cf9d3037d32629daf4c923eda4",
      "raw_sha256": "af9d34a18019d994852fe38933d1f000b0bd6f2536d63c41e6365ba8d8b26864",
      "case_manifest": {
        "sha256": "49bc7e60ade603e07255a3096b94803423aa3a2fbd058a3aca604d4edfaf0072"
      },
      "snippet_registry": {
        "sha256": "a1ffffc778f82789f1c1ac4027a109fc76e4b315ef2e3a5bdbfc47c8f84ce951"
      },
      "observed": {
        "sqlstate": "25P01",
        "primary": "SAVEPOINT can only be used in transaction blocks",
        "after_error": "IDLE",
        "after_begin": "INTRANS",
        "final_status": "IDLE"
      },
      "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": "25P01",
                "name": "no-active-transaction sqlstate",
                "observed": "25P01",
                "passed": true
              },
              {
                "expected": "SAVEPOINT can only be used in transaction blocks",
                "name": "savepoint requires transaction block",
                "observed": "SAVEPOINT can only be used in transaction blocks",
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "autocommit error stays idle",
                "observed": "IDLE",
                "passed": true
              },
              {
                "expected": "SAVEPOINT/RELEASE/COMMIT and IDLE",
                "name": "explicit transaction repair succeeds",
                "observed": {
                  "begin": "INTRANS",
                  "final": "IDLE",
                  "result": 1
                },
                "passed": true
              }
            ],
            "case_id": "savepoint_without_transaction",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.01,
            "observed": {
              "connection_autocommit": true,
              "diagnostic": {
                "column_name": null,
                "constraint_name": null,
                "context": null,
                "datatype_name": null,
                "exception_type": "NoActiveSqlTransaction",
                "internal_position": null,
                "internal_query": null,
                "message_detail": null,
                "message_hint": null,
                "message_primary": "SAVEPOINT can only be used in transaction blocks",
                "schema_name": null,
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "xact.c",
                "source_function": "CheckTransactionChain",
                "source_line": "3319",
                "sqlstate": "25P01",
                "statement_position": null,
                "table_name": null,
                "text": "SAVEPOINT can only be used in transaction blocks"
              },
              "statuses": {
                "after_begin": "INTRANS",
                "after_error": "IDLE",
                "final": "IDLE"
              },
              "transaction_control": [
                "BEGIN",
                "SAVEPOINT",
                "RELEASE SAVEPOINT",
                "COMMIT"
              ]
            },
            "schema": "c25p01_savepoint_without_transaction",
            "status": "passed"
          }
        ]
      }
    }
  ]
}
