{
  "schema": 1,
  "sqlstate": "23505",
  "condition_name": "unique_violation",
  "runner": "scripts/verify_cases.py",
  "targets": {
    "latest": {
      "binary": "Homebrew PostgreSQL 18.6",
      "required": true
    },
    "pg10": {
      "image": "postgres:10",
      "required": true,
      "reason_if_unavailable": "The PG10 compatibility target is an isolated Docker container; an unavailable local Docker runtime is reported as not_run and cannot close the compatibility gate."
    }
  },
  "cases": [
    {
      "id": "dml_unique_conflict",
      "versions": [
        "10",
        "18"
      ],
      "preconditions": [
        "A disposable database or schema",
        "One NOT DEFERRABLE unique constraint"
      ],
      "trigger": "Insert a second row with the same email value.",
      "assertions": [
        "SQLSTATE is 23505",
        "Protocol diagnostics identify the schema, table, and constraint",
        "A successful autocommit connection is IDLE after the error"
      ],
      "repair": "Choose a valid key or change the business operation; do not discard the collision implicitly.",
      "cleanup": "Drop the case schema with an owner connection."
    },
    {
      "id": "explicit_tx_abort_recovery",
      "versions": [
        "10",
        "18"
      ],
      "preconditions": [
        "An explicit transaction",
        "One unique constraint"
      ],
      "trigger": "Cause 23505 after BEGIN, then issue a statement before rollback.",
      "assertions": [
        "The failed transaction is INERROR",
        "The next statement gets 25P02",
        "ROLLBACK restores a usable connection"
      ],
      "repair": "ROLLBACK the transaction, then retry a deliberate valid operation.",
      "cleanup": "Drop the case schema with an owner connection."
    },
    {
      "id": "savepoint_recovery",
      "versions": [
        "10",
        "18"
      ],
      "preconditions": [
        "An explicit transaction and SAVEPOINT",
        "One unique constraint"
      ],
      "trigger": "Cause 23505 after a savepoint while an outer change is pending.",
      "assertions": [
        "The failed subtransaction is INERROR",
        "ROLLBACK TO SAVEPOINT restores INTRANS",
        "The outer change and post-savepoint repair both commit"
      ],
      "repair": "ROLLBACK TO the savepoint and continue with a valid operation.",
      "cleanup": "Drop the case schema with an owner connection."
    },
    {
      "id": "deferred_commit_conflict",
      "versions": [
        "10",
        "18"
      ],
      "preconditions": [
        "A DEFERRABLE INITIALLY DEFERRED unique constraint",
        "Two duplicate rows in one transaction"
      ],
      "trigger": "Insert both rows successfully and commit.",
      "assertions": [
        "The inserts are accepted before COMMIT",
        "COMMIT raises 23505",
        "The failed top-level transaction returns to IDLE and its rows are rolled back"
      ],
      "repair": "Make keys unique before COMMIT or roll back and retry the whole transaction.",
      "cleanup": "Drop the case schema with an owner connection."
    },
    {
      "id": "plpgsql_exception_recovery",
      "versions": [
        "10",
        "18"
      ],
      "preconditions": [
        "PL/pgSQL language",
        "A function that catches unique_violation"
      ],
      "trigger": "A natural duplicate insert inside the function.",
      "assertions": [
        "GET STACKED DIAGNOSTICS reports 23505",
        "The surrounding call succeeds",
        "The handler's repair row commits"
      ],
      "repair": "Use a narrowly scoped EXCEPTION handler and verify which statement caused the violation.",
      "cleanup": "Drop the function and case schema with an owner connection."
    },
    {
      "id": "concurrent_unique_conflict",
      "versions": [
        "10",
        "18"
      ],
      "preconditions": [
        "Two sessions",
        "A unique index",
        "An observer session reading pg_stat_activity"
      ],
      "trigger": "Session A holds an uncommitted key while session B inserts the same key.",
      "assertions": [
        "B is observed waiting on a lock before A commits",
        "B receives 23505 after A commits",
        "B is INERROR until rollback and exactly one row remains"
      ],
      "repair": "Coordinate key allocation or retry the complete transaction when the business operation is retryable.",
      "cleanup": "Roll back both workers if needed, then drop the case schema."
    },
    {
      "id": "on_conflict_target_scope",
      "versions": [
        "10",
        "18"
      ],
      "preconditions": [
        "Separate unique email and phone constraints",
        "A pre-existing phone value"
      ],
      "trigger": "Use ON CONFLICT (email) for a row that collides only on phone.",
      "assertions": [
        "The targeted email clause does not suppress a phone collision",
        "An omitted-target DO NOTHING handles a usable unique conflict",
        "The result is checked against the intended business policy"
      ],
      "repair": "Select the conflict target and DO UPDATE/DO NOTHING policy to match the business invariant; reconcile idempotency requests with the original request and result.",
      "cleanup": "Drop the case schema with an owner connection."
    },
    {
      "id": "nulls_not_distinct",
      "versions": [
        "15",
        "16",
        "17",
        "18"
      ],
      "preconditions": [
        "PostgreSQL 15 or later",
        "UNIQUE NULLS NOT DISTINCT is explicitly declared"
      ],
      "trigger": "Insert a second NULL into the explicit NULLS NOT DISTINCT constraint.",
      "assertions": [
        "The second NULL raises 23505",
        "The diagnostic identifies the explicit constraint",
        "The behavior is not attributed to an upgrade changing the old default"
      ],
      "repair": "Choose NULLS DISTINCT (the default) or NULLS NOT DISTINCT deliberately for the invariant.",
      "cleanup": "Drop the case schema with an owner connection."
    },
    {
      "id": "nulls_not_distinct_version_boundary",
      "versions": [
        "14",
        "15"
      ],
      "preconditions": [
        "A disposable PostgreSQL 14 or 15 target",
        "One ordinary UNIQUE and one explicit UNIQUE NULLS NOT DISTINCT declaration"
      ],
      "trigger": "Insert two NULLs under ordinary UNIQUE, then execute the explicit NULLS NOT DISTINCT declaration and, where supported, a second NULL.",
      "assertions": [
        "Ordinary UNIQUE accepts two NULLs on both targets",
        "PG14 records the actual unsupported syntax diagnostic",
        "PG15 records a natural 23505 for the explicit second NULL and a valid repair"
      ],
      "repair": "Use the explicit NULL policy deliberately; after the supported duplicate, insert a valid non-duplicate value and verify the connection remains usable.",
      "cleanup": "Drop the case schema with an owner connection."
    },
    {
      "id": "sequence_lag_repair",
      "versions": [
        "10",
        "18"
      ],
      "preconditions": [
        "A controlled, quiesced case schema",
        "A sequence with START 100 and INCREMENT 7"
      ],
      "trigger": "Insert an explicit key equal to the sequence's first value, then call nextval.",
      "assertions": [
        "The stale nextval causes a real 23505",
        "setval(max(id), true) moves the next value to 107 in this controlled case",
        "The result records sequence identity and non-default increment"
      ],
      "repair": "Inspect the sequence and table, then repair only under a controlled writer-free window; handle an empty table and non-default bounds/increment separately.",
      "cleanup": "Drop the case schema with an owner connection."
    },
    {
      "id": "index_build_conflict",
      "versions": [
        "10",
        "18"
      ],
      "preconditions": [
        "Duplicate table rows",
        "Owner connection for index cleanup"
      ],
      "trigger": "Build a regular unique index and then a concurrent unique index over duplicate rows.",
      "assertions": [
        "Both failures are 23505 with the index-build message template",
        "The regular build leaves no index",
        "The concurrent failure's actual pg_index state is recorded and is not generalized to every CIC failure"
      ],
      "repair": "Resolve duplicates, drop an invalid concurrent index when present, and retry the appropriate build.",
      "cleanup": "Drop any leftover indexes and the case schema with an owner connection."
    },
    {
      "id": "diagnostic_visibility",
      "versions": [
        "10",
        "18"
      ],
      "preconditions": [
        "A restricted login role with INSERT but no SELECT privilege",
        "A seeded unique row"
      ],
      "trigger": "The restricted role inserts a duplicate key.",
      "assertions": [
        "SQLSTATE and protocol object fields remain available",
        "The key detail can be omitted when the role cannot inspect the key columns"
      ],
      "repair": "Use permitted diagnostics and server logs; do not assume detail is always present.",
      "cleanup": "Drop the role, table, and schema with an owner connection."
    },
    {
      "id": "log_fields",
      "versions": [
        "10",
        "18"
      ],
      "preconditions": [
        "A dedicated cluster with logging_collector and csvlog; jsonlog when supported"
      ],
      "trigger": "Cause a duplicate-key error and read the collector output.",
      "assertions": [
        "CSV/JSON log records expose SQLSTATE, message, and detail",
        "The protocol constraint_name is not treated as a CSV/JSON standard key",
        "The exact emitted record is tied to this run"
      ],
      "repair": "Correlate logs with SQLSTATE and message fields; obtain object identity from the ErrorResponse or structured server context where available.",
      "cleanup": "Stop and remove only the runner-owned cluster or container."
    }
  ],
  "evidence_status": "authored",
  "snippets": [
    {
      "id": "explicit_tx_abort_recovery",
      "case_id": "explicit_tx_abort_recovery",
      "language": "sql",
      "statements": {
        "create": "CREATE TABLE items(id integer PRIMARY KEY, note text UNIQUE NOT NULL)",
        "seed": "INSERT INTO items VALUES (1, 'seed')",
        "begin": "BEGIN",
        "outer": "INSERT INTO items VALUES (2, 'outer')",
        "trigger": "INSERT INTO items VALUES (3, 'seed')",
        "rollback": "ROLLBACK",
        "repair_begin": "BEGIN",
        "repair": "INSERT INTO items VALUES (2, 'after rollback')",
        "commit": "COMMIT"
      }
    },
    {
      "id": "savepoint_recovery",
      "case_id": "savepoint_recovery",
      "language": "sql",
      "statements": {
        "create": "CREATE TABLE items(id integer PRIMARY KEY, note text UNIQUE NOT NULL)",
        "seed": "INSERT INTO items VALUES (1, 'seed')",
        "begin": "BEGIN",
        "outer": "INSERT INTO items VALUES (2, 'outer')",
        "savepoint": "SAVEPOINT unique_case",
        "trigger": "INSERT INTO items VALUES (3, 'seed')",
        "probe": "SELECT count(*) FROM items",
        "rollback_to": "ROLLBACK TO SAVEPOINT unique_case",
        "repair": "INSERT INTO items VALUES (3, 'after savepoint')",
        "release": "RELEASE SAVEPOINT unique_case",
        "commit": "COMMIT"
      }
    },
    {
      "id": "plpgsql_exception_recovery",
      "case_id": "plpgsql_exception_recovery",
      "language": "sql",
      "statements": {
        "create": "CREATE TABLE items(id integer PRIMARY KEY, note text)",
        "seed": "INSERT INTO items(id, note) VALUES (1, 'seed')",
        "function": "CREATE FUNCTION try_insert(wanted integer) RETURNS text\nLANGUAGE plpgsql AS $$\nDECLARE returned_state text;\nBEGIN\n    INSERT INTO items(id, note) VALUES (wanted, 'body');\n    RETURN 'inserted';\nEXCEPTION WHEN unique_violation THEN\n    GET STACKED DIAGNOSTICS returned_state = RETURNED_SQLSTATE;\n    INSERT INTO items(id, note) VALUES (wanted + 1, 'handler');\n    RETURN returned_state;\nEND\n$$",
        "call": "SELECT try_insert(1)"
      }
    },
    {
      "id": "on_conflict_target_scope",
      "case_id": "on_conflict_target_scope",
      "language": "sql",
      "statements": {
        "create": "CREATE TABLE accounts(\n    id integer PRIMARY KEY,\n    email text NOT NULL,\n    phone text NOT NULL,\n    CONSTRAINT accounts_email_uq UNIQUE (email),\n    CONSTRAINT accounts_phone_uq UNIQUE (phone)\n)",
        "seed": "INSERT INTO accounts VALUES (1, 'existing@example.test', 'phone-1')",
        "email_target": "INSERT INTO accounts(id,email,phone) VALUES (2, 'existing@example.test', 'phone-2') ON CONFLICT (email) DO NOTHING",
        "phone_target": "INSERT INTO accounts(id,email,phone) VALUES (3, 'new@example.test', 'phone-1') ON CONFLICT (email) DO NOTHING",
        "omitted_target": "INSERT INTO accounts(id,email,phone) VALUES (4, 'third@example.test', 'phone-1') ON CONFLICT DO NOTHING"
      }
    },
    {
      "id": "sequence_lag_repair",
      "case_id": "sequence_lag_repair",
      "language": "sql",
      "statements": {
        "create_sequence": "CREATE SEQUENCE ids_seq START WITH 100 INCREMENT BY 7 MINVALUE 100 MAXVALUE 100000",
        "create_table": "CREATE TABLE items(id integer PRIMARY KEY, note text)",
        "explicit": "INSERT INTO items(id,note) VALUES (100, 'explicit')",
        "stale_nextval": "INSERT INTO items(id,note) VALUES (nextval('ids_seq'), 'generated')",
        "setval": "SELECT setval('ids_seq', (SELECT max(id) FROM items), true)",
        "repaired_nextval": "INSERT INTO items(id,note) VALUES (nextval('ids_seq'), 'after repair')"
      }
    },
    {
      "id": "diagnostic_catalog_queries",
      "case_id": "dml_unique_conflict",
      "language": "sql",
      "statements": {
        "constraints": "SELECT conname, contype, condeferrable, condeferred,\n       pg_get_constraintdef(oid)\nFROM pg_constraint\nWHERE conrelid = 'accounts'::regclass",
        "indexes": "SELECT indexrelid::regclass AS index_name,\n       indisunique, indisvalid, indisready, indislive,\n       pg_get_indexdef(indexrelid)\nFROM pg_index\nWHERE indrelid = 'accounts'::regclass"
      }
    },
    {
      "id": "nulls_not_distinct_version_boundary",
      "case_id": "nulls_not_distinct_version_boundary",
      "language": "sql",
      "statements": {
        "ordinary_create": "CREATE TABLE ordinary_nulls (external_id integer UNIQUE)",
        "ordinary_first": "INSERT INTO ordinary_nulls VALUES (NULL)",
        "ordinary_second": "INSERT INTO ordinary_nulls VALUES (NULL)",
        "ordinary_verify": "SELECT count(*) FROM ordinary_nulls",
        "explicit_create": "CREATE TABLE explicit_nulls (external_id integer, CONSTRAINT nulls_not_distinct_uq UNIQUE NULLS NOT DISTINCT (external_id))",
        "explicit_first": "INSERT INTO explicit_nulls VALUES (NULL)",
        "explicit_second": "INSERT INTO explicit_nulls VALUES (NULL)",
        "explicit_repair": "INSERT INTO explicit_nulls VALUES (1)",
        "explicit_verify": "SELECT count(*) FROM explicit_nulls"
      }
    }
  ],
  "runtime": [
    {
      "cases": [
        "deferred_commit_conflict",
        "concurrent_unique_conflict",
        "nulls_not_distinct",
        "index_build_conflict",
        "diagnostic_visibility"
      ],
      "id": "runtime.23505-final-20260909.latest",
      "run_id": "23505-final-20260909",
      "selection_status": "selected_for_unreplaced_cases",
      "server_version": "18.6 (Homebrew)",
      "server_version_num": 180006,
      "status": "passed",
      "target": "latest",
      "limits": "The selected cases are the full run scenarios not replaced by a more targeted final record; its former log_fields selection is excluded because the targeted run provides the exact event correlation.",
      "result": {
        "status": "passed",
        "environment": {
          "TimeZone": "Asia/Shanghai",
          "backend_pid": 97045,
          "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": "INTRANS",
                "name": "inserts accepted before commit",
                "observed": "INTRANS",
                "passed": true
              },
              {
                "expected": "23505",
                "name": "commit sqlstate",
                "observed": "23505",
                "passed": true
              },
              {
                "expected": "deferred_email_uq",
                "name": "constraint is the deferred constraint",
                "observed": "deferred_email_uq",
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "failed top-level commit returns idle",
                "observed": "IDLE",
                "passed": true
              },
              {
                "expected": 0,
                "name": "failed commit rolled back rows",
                "observed": 0,
                "passed": true
              }
            ],
            "case_id": "deferred_commit_conflict",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.011,
            "observed": {
              "diagnostic": {
                "column_name": null,
                "constraint_name": "deferred_email_uq",
                "context": null,
                "datatype_name": null,
                "exception_type": "UniqueViolation",
                "internal_position": null,
                "internal_query": null,
                "message_detail": "Key (email)=(same@example.test) already exists.",
                "message_hint": null,
                "message_primary": "duplicate key value violates unique constraint \"deferred_email_uq\"",
                "schema_name": "c23505_deferred_commit_conflict",
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "nbtinsert.c",
                "source_function": "_bt_check_unique",
                "source_line": "673",
                "sqlstate": "23505",
                "statement_position": null,
                "table_name": "items",
                "text": "duplicate key value violates unique constraint \"deferred_email_uq\"\nDETAIL:  Key (email)=(same@example.test) already exists."
              },
              "row_count": 0,
              "statuses": {
                "after_commit": "IDLE",
                "before_commit": "INTRANS"
              }
            },
            "schema": "c23505_deferred_commit_conflict",
            "status": "passed"
          },
          {
            "assertions": [
              {
                "expected": true,
                "name": "worker started",
                "observed": true,
                "passed": true
              },
              {
                "expected": "wait_event_type=Lock",
                "name": "wait observed before release",
                "observed": {
                  "query": "INSERT INTO \"c23505_concurrent_unique_conflict\".\"items\"(id, token) VALUES (2, 'raced')",
                  "state": "active",
                  "wait_event": "transactionid",
                  "wait_event_type": "Lock"
                },
                "passed": true
              },
              {
                "expected": "23505",
                "name": "blocked insert sqlstate",
                "observed": "23505",
                "passed": true
              },
              {
                "expected": "INERROR",
                "name": "blocked session was inerror before rollback",
                "observed": "INERROR",
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "first session committed",
                "observed": "IDLE",
                "passed": true
              },
              {
                "expected": 1,
                "name": "one winner row remains",
                "observed": 1,
                "passed": true
              }
            ],
            "case_id": "concurrent_unique_conflict",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.015,
            "observed": {
              "activity_samples": [
                {
                  "query": "INSERT INTO \"c23505_concurrent_unique_conflict\".\"items\"(id, token) VALUES (2, 'raced')",
                  "state": "active",
                  "wait_event": "transactionid",
                  "wait_event_type": "Lock"
                }
              ],
              "blocked_session": {
                "pid": 97073,
                "result": {
                  "error": {
                    "column_name": null,
                    "constraint_name": "items_token_key",
                    "context": null,
                    "datatype_name": null,
                    "exception_type": "UniqueViolation",
                    "internal_position": null,
                    "internal_query": null,
                    "message_detail": "Key (token)=(raced) already exists.",
                    "message_hint": null,
                    "message_primary": "duplicate key value violates unique constraint \"items_token_key\"",
                    "schema_name": "c23505_concurrent_unique_conflict",
                    "severity": "ERROR",
                    "severity_nonlocalized": "ERROR",
                    "source_file": "nbtinsert.c",
                    "source_function": "_bt_check_unique",
                    "source_line": "673",
                    "sqlstate": "23505",
                    "statement_position": null,
                    "table_name": "items",
                    "text": "duplicate key value violates unique constraint \"items_token_key\"\nDETAIL:  Key (token)=(raced) already exists."
                  },
                  "status": "INERROR"
                }
              },
              "first_session": {
                "pid": null,
                "status_after_commit": "IDLE"
              },
              "row_count": 1
            },
            "schema": "c23505_concurrent_unique_conflict",
            "status": "passed"
          },
          {
            "assertions": [
              {
                "expected": "23505",
                "name": "explicit second NULL sqlstate",
                "observed": "23505",
                "passed": true
              },
              {
                "expected": "nulls_not_distinct_uq",
                "name": "explicit constraint is identified",
                "observed": "nulls_not_distinct_uq",
                "passed": true
              },
              {
                "expected": 2,
                "name": "default remains NULLS DISTINCT",
                "observed": 2,
                "passed": true
              },
              {
                "expected": "error",
                "name": "natural duplicate was raised",
                "observed": "error",
                "passed": true
              }
            ],
            "case_id": "nulls_not_distinct",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.007,
            "observed": {
              "default_null_row_count": 2,
              "diagnostic": {
                "column_name": null,
                "constraint_name": "nulls_not_distinct_uq",
                "context": null,
                "datatype_name": null,
                "exception_type": "UniqueViolation",
                "internal_position": null,
                "internal_query": null,
                "message_detail": "Key (external_id)=(null) already exists.",
                "message_hint": null,
                "message_primary": "duplicate key value violates unique constraint \"nulls_not_distinct_uq\"",
                "schema_name": "c23505_nulls_not_distinct",
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "nbtinsert.c",
                "source_function": "_bt_check_unique",
                "source_line": "673",
                "sqlstate": "23505",
                "statement_position": null,
                "table_name": "explicit_nulls",
                "text": "duplicate key value violates unique constraint \"nulls_not_distinct_uq\"\nDETAIL:  Key (external_id)=(null) already exists."
              }
            },
            "schema": "c23505_nulls_not_distinct",
            "status": "passed"
          },
          {
            "assertions": [
              {
                "expected": "23505",
                "name": "regular build sqlstate",
                "observed": "23505",
                "passed": true
              },
              {
                "expected": true,
                "name": "regular build uses index message",
                "observed": "could not create unique index \"idx_regular\"",
                "passed": true
              },
              {
                "expected": "INERROR",
                "name": "regular failure is transactional",
                "observed": "INERROR",
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "regular rollback restores idle",
                "observed": "IDLE",
                "passed": true
              },
              {
                "expected": "no row",
                "name": "regular build leaves no index",
                "observed": null,
                "passed": true
              },
              {
                "expected": "23505",
                "name": "concurrent build sqlstate",
                "observed": "23505",
                "passed": true
              },
              {
                "expected": true,
                "name": "concurrent build uses index message",
                "observed": "could not create unique index \"idx_concurrent\"",
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "concurrent failure connection state",
                "observed": "IDLE",
                "passed": true
              },
              {
                "expected": "index row",
                "name": "concurrent failure leaves inspectable index",
                "observed": [
                  "idx_concurrent",
                  false,
                  false,
                  true,
                  true
                ],
                "passed": true
              },
              {
                "expected": false,
                "name": "concurrent leftover is invalid",
                "observed": false,
                "passed": true
              },
              {
                "expected": true,
                "name": "concurrent leftover remains unique",
                "observed": true,
                "passed": true
              }
            ],
            "case_id": "index_build_conflict",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.014,
            "observed": {
              "concurrent": {
                "catalog_row": [
                  "idx_concurrent",
                  false,
                  false,
                  true,
                  true
                ],
                "diagnostic": {
                  "column_name": null,
                  "constraint_name": "idx_concurrent",
                  "context": null,
                  "datatype_name": null,
                  "exception_type": "UniqueViolation",
                  "internal_position": null,
                  "internal_query": null,
                  "message_detail": "Key (email)=(dup) is duplicated.",
                  "message_hint": null,
                  "message_primary": "could not create unique index \"idx_concurrent\"",
                  "schema_name": "c23505_index_build_conflict",
                  "severity": "ERROR",
                  "severity_nonlocalized": "ERROR",
                  "source_file": "tuplesortvariants.c",
                  "source_function": "comparetup_index_btree_tiebreak",
                  "source_line": "1693",
                  "sqlstate": "23505",
                  "statement_position": null,
                  "table_name": "dupes",
                  "text": "could not create unique index \"idx_concurrent\"\nDETAIL:  Key (email)=(dup) is duplicated."
                },
                "status": "IDLE"
              },
              "regular": {
                "after_rollback": "IDLE",
                "catalog_row": null,
                "diagnostic": {
                  "column_name": null,
                  "constraint_name": "idx_regular",
                  "context": null,
                  "datatype_name": null,
                  "exception_type": "UniqueViolation",
                  "internal_position": null,
                  "internal_query": null,
                  "message_detail": "Key (email)=(dup) is duplicated.",
                  "message_hint": null,
                  "message_primary": "could not create unique index \"idx_regular\"",
                  "schema_name": "c23505_index_build_conflict",
                  "severity": "ERROR",
                  "severity_nonlocalized": "ERROR",
                  "source_file": "tuplesortvariants.c",
                  "source_function": "comparetup_index_btree_tiebreak",
                  "source_line": "1693",
                  "sqlstate": "23505",
                  "statement_position": null,
                  "table_name": "dupes",
                  "text": "could not create unique index \"idx_regular\"\nDETAIL:  Key (email)=(dup) is duplicated."
                },
                "status": "INERROR"
              },
              "state_scope": "duplicate found during this concurrent build scan; other CIC failure stages require separate observation"
            },
            "schema": "c23505_index_build_conflict",
            "status": "passed"
          },
          {
            "assertions": [
              {
                "expected": "23505",
                "name": "restricted role sqlstate",
                "observed": "23505",
                "passed": true
              },
              {
                "expected": "schema/table/constraint",
                "name": "protocol object fields remain visible",
                "observed": {
                  "constraint": "secret_items_token_key",
                  "schema": "c23505_diagnostic_visibility",
                  "table": "secret_items"
                },
                "passed": true
              },
              {
                "expected": "omitted",
                "name": "key detail omitted without SELECT",
                "observed": null,
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "autocommit restricted connection is idle",
                "observed": "IDLE",
                "passed": true
              },
              {
                "expected": "error",
                "name": "natural duplicate was raised",
                "observed": "error",
                "passed": true
              }
            ],
            "case_id": "diagnostic_visibility",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.01,
            "observed": {
              "diagnostic": {
                "column_name": null,
                "constraint_name": "secret_items_token_key",
                "context": null,
                "datatype_name": null,
                "exception_type": "UniqueViolation",
                "internal_position": null,
                "internal_query": null,
                "message_detail": null,
                "message_hint": null,
                "message_primary": "duplicate key value violates unique constraint \"secret_items_token_key\"",
                "schema_name": "c23505_diagnostic_visibility",
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "nbtinsert.c",
                "source_function": "_bt_check_unique",
                "source_line": "673",
                "sqlstate": "23505",
                "statement_position": null,
                "table_name": "secret_items",
                "text": "duplicate key value violates unique constraint \"secret_items_token_key\""
              },
              "role": "u23505_056473a9d8",
              "transaction_status": "IDLE"
            },
            "schema": "c23505_diagnostic_visibility",
            "status": "passed"
          }
        ]
      }
    },
    {
      "cases_not_applicable": [
        "nulls_not_distinct"
      ],
      "cases_passed": 11,
      "id": "runtime.23505-final-20260909.pg10",
      "image": "postgres@sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc",
      "run_id": "23505-final-20260909",
      "selection_status": "selected_for_unreplaced_cases",
      "server_version": "10.21 (Debian 10.21-1.pgdg90+1)",
      "server_version_num": 100021,
      "status": "passed",
      "target": "pg10",
      "cases": [
        "deferred_commit_conflict",
        "concurrent_unique_conflict",
        "index_build_conflict",
        "diagnostic_visibility"
      ],
      "limits": "The selected cases are the full run scenarios not replaced by a more targeted final record; its former log_fields selection is excluded because the targeted run provides the exact event correlation.",
      "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": "INTRANS",
                "name": "inserts accepted before commit",
                "observed": "INTRANS",
                "passed": true
              },
              {
                "expected": "23505",
                "name": "commit sqlstate",
                "observed": "23505",
                "passed": true
              },
              {
                "expected": "deferred_email_uq",
                "name": "constraint is the deferred constraint",
                "observed": "deferred_email_uq",
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "failed top-level commit returns idle",
                "observed": "IDLE",
                "passed": true
              },
              {
                "expected": 0,
                "name": "failed commit rolled back rows",
                "observed": 0,
                "passed": true
              }
            ],
            "case_id": "deferred_commit_conflict",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.022,
            "observed": {
              "diagnostic": {
                "column_name": null,
                "constraint_name": "deferred_email_uq",
                "context": null,
                "datatype_name": null,
                "exception_type": "UniqueViolation",
                "internal_position": null,
                "internal_query": null,
                "message_detail": "Key (email)=(same@example.test) already exists.",
                "message_hint": null,
                "message_primary": "duplicate key value violates unique constraint \"deferred_email_uq\"",
                "schema_name": "c23505_deferred_commit_conflict",
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "nbtinsert.c",
                "source_function": "_bt_check_unique",
                "source_line": "434",
                "sqlstate": "23505",
                "statement_position": null,
                "table_name": "items",
                "text": "duplicate key value violates unique constraint \"deferred_email_uq\"\nDETAIL:  Key (email)=(same@example.test) already exists."
              },
              "row_count": 0,
              "statuses": {
                "after_commit": "IDLE",
                "before_commit": "INTRANS"
              }
            },
            "schema": "c23505_deferred_commit_conflict",
            "status": "passed"
          },
          {
            "assertions": [
              {
                "expected": true,
                "name": "worker started",
                "observed": true,
                "passed": true
              },
              {
                "expected": "wait_event_type=Lock",
                "name": "wait observed before release",
                "observed": {
                  "query": "INSERT INTO \"c23505_concurrent_unique_conflict\".\"items\"(id, token) VALUES (2, 'raced')",
                  "state": "active",
                  "wait_event": "transactionid",
                  "wait_event_type": "Lock"
                },
                "passed": true
              },
              {
                "expected": "23505",
                "name": "blocked insert sqlstate",
                "observed": "23505",
                "passed": true
              },
              {
                "expected": "INERROR",
                "name": "blocked session was inerror before rollback",
                "observed": "INERROR",
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "first session committed",
                "observed": "IDLE",
                "passed": true
              },
              {
                "expected": 1,
                "name": "one winner row remains",
                "observed": 1,
                "passed": true
              }
            ],
            "case_id": "concurrent_unique_conflict",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.025,
            "observed": {
              "activity_samples": [
                {
                  "query": "INSERT INTO \"c23505_concurrent_unique_conflict\".\"items\"(id, token) VALUES (2, 'raced')",
                  "state": "active",
                  "wait_event": "transactionid",
                  "wait_event_type": "Lock"
                }
              ],
              "blocked_session": {
                "pid": 104,
                "result": {
                  "error": {
                    "column_name": null,
                    "constraint_name": "items_token_key",
                    "context": null,
                    "datatype_name": null,
                    "exception_type": "UniqueViolation",
                    "internal_position": null,
                    "internal_query": null,
                    "message_detail": "Key (token)=(raced) already exists.",
                    "message_hint": null,
                    "message_primary": "duplicate key value violates unique constraint \"items_token_key\"",
                    "schema_name": "c23505_concurrent_unique_conflict",
                    "severity": "ERROR",
                    "severity_nonlocalized": "ERROR",
                    "source_file": "nbtinsert.c",
                    "source_function": "_bt_check_unique",
                    "source_line": "434",
                    "sqlstate": "23505",
                    "statement_position": null,
                    "table_name": "items",
                    "text": "duplicate key value violates unique constraint \"items_token_key\"\nDETAIL:  Key (token)=(raced) already exists."
                  },
                  "status": "INERROR"
                }
              },
              "first_session": {
                "pid": null,
                "status_after_commit": "IDLE"
              },
              "row_count": 1
            },
            "schema": "c23505_concurrent_unique_conflict",
            "status": "passed"
          },
          {
            "assertions": [],
            "case_id": "nulls_not_distinct",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.006,
            "observed": {
              "server_version_num": 100021
            },
            "reason": "UNIQUE NULLS NOT DISTINCT requires PostgreSQL 15 or later",
            "schema": "c23505_nulls_not_distinct",
            "status": "not_applicable"
          },
          {
            "assertions": [
              {
                "expected": "23505",
                "name": "regular build sqlstate",
                "observed": "23505",
                "passed": true
              },
              {
                "expected": true,
                "name": "regular build uses index message",
                "observed": "could not create unique index \"idx_regular\"",
                "passed": true
              },
              {
                "expected": "INERROR",
                "name": "regular failure is transactional",
                "observed": "INERROR",
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "regular rollback restores idle",
                "observed": "IDLE",
                "passed": true
              },
              {
                "expected": "no row",
                "name": "regular build leaves no index",
                "observed": null,
                "passed": true
              },
              {
                "expected": "23505",
                "name": "concurrent build sqlstate",
                "observed": "23505",
                "passed": true
              },
              {
                "expected": true,
                "name": "concurrent build uses index message",
                "observed": "could not create unique index \"idx_concurrent\"",
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "concurrent failure connection state",
                "observed": "IDLE",
                "passed": true
              },
              {
                "expected": "index row",
                "name": "concurrent failure leaves inspectable index",
                "observed": [
                  "idx_concurrent",
                  false,
                  false,
                  true,
                  true
                ],
                "passed": true
              },
              {
                "expected": false,
                "name": "concurrent leftover is invalid",
                "observed": false,
                "passed": true
              },
              {
                "expected": true,
                "name": "concurrent leftover remains unique",
                "observed": true,
                "passed": true
              }
            ],
            "case_id": "index_build_conflict",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.024,
            "observed": {
              "concurrent": {
                "catalog_row": [
                  "idx_concurrent",
                  false,
                  false,
                  true,
                  true
                ],
                "diagnostic": {
                  "column_name": null,
                  "constraint_name": "idx_concurrent",
                  "context": null,
                  "datatype_name": null,
                  "exception_type": "UniqueViolation",
                  "internal_position": null,
                  "internal_query": null,
                  "message_detail": "Key (email)=(dup) is duplicated.",
                  "message_hint": null,
                  "message_primary": "could not create unique index \"idx_concurrent\"",
                  "schema_name": "c23505_index_build_conflict",
                  "severity": "ERROR",
                  "severity_nonlocalized": "ERROR",
                  "source_file": "tuplesort.c",
                  "source_function": "comparetup_index_btree",
                  "source_line": "4155",
                  "sqlstate": "23505",
                  "statement_position": null,
                  "table_name": "dupes",
                  "text": "could not create unique index \"idx_concurrent\"\nDETAIL:  Key (email)=(dup) is duplicated."
                },
                "status": "IDLE"
              },
              "regular": {
                "after_rollback": "IDLE",
                "catalog_row": null,
                "diagnostic": {
                  "column_name": null,
                  "constraint_name": "idx_regular",
                  "context": null,
                  "datatype_name": null,
                  "exception_type": "UniqueViolation",
                  "internal_position": null,
                  "internal_query": null,
                  "message_detail": "Key (email)=(dup) is duplicated.",
                  "message_hint": null,
                  "message_primary": "could not create unique index \"idx_regular\"",
                  "schema_name": "c23505_index_build_conflict",
                  "severity": "ERROR",
                  "severity_nonlocalized": "ERROR",
                  "source_file": "tuplesort.c",
                  "source_function": "comparetup_index_btree",
                  "source_line": "4155",
                  "sqlstate": "23505",
                  "statement_position": null,
                  "table_name": "dupes",
                  "text": "could not create unique index \"idx_regular\"\nDETAIL:  Key (email)=(dup) is duplicated."
                },
                "status": "INERROR"
              },
              "state_scope": "duplicate found during this concurrent build scan; other CIC failure stages require separate observation"
            },
            "schema": "c23505_index_build_conflict",
            "status": "passed"
          },
          {
            "assertions": [
              {
                "expected": "23505",
                "name": "restricted role sqlstate",
                "observed": "23505",
                "passed": true
              },
              {
                "expected": "schema/table/constraint",
                "name": "protocol object fields remain visible",
                "observed": {
                  "constraint": "secret_items_token_key",
                  "schema": "c23505_diagnostic_visibility",
                  "table": "secret_items"
                },
                "passed": true
              },
              {
                "expected": "omitted",
                "name": "key detail omitted without SELECT",
                "observed": null,
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "autocommit restricted connection is idle",
                "observed": "IDLE",
                "passed": true
              },
              {
                "expected": "error",
                "name": "natural duplicate was raised",
                "observed": "error",
                "passed": true
              }
            ],
            "case_id": "diagnostic_visibility",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.024,
            "observed": {
              "diagnostic": {
                "column_name": null,
                "constraint_name": "secret_items_token_key",
                "context": null,
                "datatype_name": null,
                "exception_type": "UniqueViolation",
                "internal_position": null,
                "internal_query": null,
                "message_detail": null,
                "message_hint": null,
                "message_primary": "duplicate key value violates unique constraint \"secret_items_token_key\"",
                "schema_name": "c23505_diagnostic_visibility",
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "nbtinsert.c",
                "source_function": "_bt_check_unique",
                "source_line": "434",
                "sqlstate": "23505",
                "statement_position": null,
                "table_name": "secret_items",
                "text": "duplicate key value violates unique constraint \"secret_items_token_key\""
              },
              "role": "u23505_decf1aa6b6",
              "transaction_status": "IDLE"
            },
            "schema": "c23505_diagnostic_visibility",
            "status": "passed"
          }
        ]
      }
    },
    {
      "cases": [
        "plpgsql_exception_recovery",
        "on_conflict_target_scope",
        "sequence_lag_repair"
      ],
      "id": "runtime.23505-snippet-contract-20260909.latest",
      "run_id": "23505-snippet-contract-20260909",
      "server_version": "18.6 (Homebrew)",
      "server_version_num": 180006,
      "status": "passed",
      "target": "latest",
      "selection_status": "selected_for_registry_snippets",
      "limits": "The selected cases are the registry-backed PL/pgSQL, ON CONFLICT, and sequence excerpts; explicit transaction and savepoint cases use the manual-boundary runs below.",
      "result": {
        "status": "passed",
        "environment": {
          "TimeZone": "Asia/Shanghai",
          "backend_pid": 91856,
          "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": "23505",
                "name": "handler saw natural sqlstate",
                "observed": "23505",
                "passed": true
              },
              {
                "expected": "handler row",
                "name": "handler repair committed",
                "observed": [
                  [
                    1,
                    "seed"
                  ],
                  [
                    2,
                    "handler"
                  ]
                ],
                "passed": true
              },
              {
                "expected": "successful call",
                "name": "call did not abort surrounding transaction",
                "observed": "successful call",
                "passed": true
              }
            ],
            "case_id": "plpgsql_exception_recovery",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.046,
            "observed": {
              "returned_sqlstate": "23505",
              "rows": [
                [
                  1,
                  "seed"
                ],
                [
                  2,
                  "handler"
                ]
              ]
            },
            "schema": "c23505_plpgsql_exception_recovery",
            "status": "passed"
          },
          {
            "assertions": [
              {
                "expected": 1,
                "name": "email target handles email collision",
                "observed": 1,
                "passed": true
              },
              {
                "expected": "23505",
                "name": "phone collision escapes email target",
                "observed": "23505",
                "passed": true
              },
              {
                "expected": "accounts_phone_uq",
                "name": "phone constraint is reported",
                "observed": "accounts_phone_uq",
                "passed": true
              },
              {
                "expected": "success",
                "name": "omitted target handles usable conflict",
                "observed": "success",
                "passed": true
              },
              {
                "expected": 1,
                "name": "omitted target keeps row count",
                "observed": 1,
                "passed": true
              }
            ],
            "case_id": "on_conflict_target_scope",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.061,
            "observed": {
              "omitted_target_error": {},
              "row_counts": {
                "after_email_target": 1,
                "after_omitted_target": 1
              },
              "targeted_duplicate": {
                "column_name": null,
                "constraint_name": "accounts_phone_uq",
                "context": null,
                "datatype_name": null,
                "exception_type": "UniqueViolation",
                "internal_position": null,
                "internal_query": null,
                "message_detail": "Key (phone)=(phone-1) already exists.",
                "message_hint": null,
                "message_primary": "duplicate key value violates unique constraint \"accounts_phone_uq\"",
                "schema_name": "c23505_on_conflict_target_scope",
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "nbtinsert.c",
                "source_function": "_bt_check_unique",
                "source_line": "673",
                "sqlstate": "23505",
                "statement_position": null,
                "table_name": "accounts",
                "text": "duplicate key value violates unique constraint \"accounts_phone_uq\"\nDETAIL:  Key (phone)=(phone-1) already exists."
              },
              "targeted_status_before_rollback": "IDLE"
            },
            "schema": "c23505_on_conflict_target_scope",
            "status": "passed"
          },
          {
            "assertions": [
              {
                "expected": "23505",
                "name": "stale sequence causes natural 23505",
                "observed": "23505",
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "autocommit remains usable",
                "observed": "IDLE",
                "passed": true
              },
              {
                "expected": 7,
                "name": "sequence increment is non-default",
                "observed": 7,
                "passed": true
              },
              {
                "expected": 100,
                "name": "controlled setval repair returns max",
                "observed": 100,
                "passed": true
              },
              {
                "expected": "100 and 107",
                "name": "next value honors increment",
                "observed": [
                  [
                    100,
                    "explicit"
                  ],
                  [
                    107,
                    "after repair"
                  ]
                ],
                "passed": true
              },
              {
                "expected": "(100, true)",
                "name": "sequence was called after failed nextval",
                "observed": [
                  100,
                  true
                ],
                "passed": true
              },
              {
                "expected": "(107, true)",
                "name": "final sequence state is recorded",
                "observed": [
                  107,
                  true
                ],
                "passed": true
              }
            ],
            "case_id": "sequence_lag_repair",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.046,
            "observed": {
              "diagnostic": {
                "column_name": null,
                "constraint_name": "items_pkey",
                "context": null,
                "datatype_name": null,
                "exception_type": "UniqueViolation",
                "internal_position": null,
                "internal_query": null,
                "message_detail": "Key (id)=(100) already exists.",
                "message_hint": null,
                "message_primary": "duplicate key value violates unique constraint \"items_pkey\"",
                "schema_name": "c23505_sequence_lag_repair",
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "nbtinsert.c",
                "source_function": "_bt_check_unique",
                "source_line": "673",
                "sqlstate": "23505",
                "statement_position": null,
                "table_name": "items",
                "text": "duplicate key value violates unique constraint \"items_pkey\"\nDETAIL:  Key (id)=(100) already exists."
              },
              "max_id": 100,
              "rows": [
                [
                  100,
                  "explicit"
                ],
                [
                  107,
                  "after repair"
                ]
              ],
              "sequence": {
                "after_repair": [
                  107,
                  true
                ],
                "before_repair": [
                  100,
                  true
                ],
                "increment_by": 7,
                "relation": "\"c23505_sequence_lag_repair\".\"ids_seq\""
              }
            },
            "schema": "c23505_sequence_lag_repair",
            "status": "passed"
          }
        ]
      }
    },
    {
      "cases": [
        "plpgsql_exception_recovery",
        "on_conflict_target_scope",
        "sequence_lag_repair"
      ],
      "id": "runtime.23505-snippet-contract-20260909.pg10",
      "run_id": "23505-snippet-contract-20260909",
      "server_version": "10.21 (Debian 10.21-1.pgdg90+1)",
      "server_version_num": 100021,
      "status": "passed",
      "target": "pg10",
      "selection_status": "selected_for_registry_snippets",
      "limits": "The selected cases are the registry-backed PL/pgSQL, ON CONFLICT, and sequence excerpts; explicit transaction and savepoint cases use the manual-boundary runs below.",
      "result": {
        "status": "passed",
        "environment": {
          "TimeZone": "Etc/UTC",
          "backend_pid": 78,
          "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": "23505",
                "name": "handler saw natural sqlstate",
                "observed": "23505",
                "passed": true
              },
              {
                "expected": "handler row",
                "name": "handler repair committed",
                "observed": [
                  [
                    1,
                    "seed"
                  ],
                  [
                    2,
                    "handler"
                  ]
                ],
                "passed": true
              },
              {
                "expected": "successful call",
                "name": "call did not abort surrounding transaction",
                "observed": "successful call",
                "passed": true
              }
            ],
            "case_id": "plpgsql_exception_recovery",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.109,
            "observed": {
              "returned_sqlstate": "23505",
              "rows": [
                [
                  1,
                  "seed"
                ],
                [
                  2,
                  "handler"
                ]
              ]
            },
            "schema": "c23505_plpgsql_exception_recovery",
            "status": "passed"
          },
          {
            "assertions": [
              {
                "expected": 1,
                "name": "email target handles email collision",
                "observed": 1,
                "passed": true
              },
              {
                "expected": "23505",
                "name": "phone collision escapes email target",
                "observed": "23505",
                "passed": true
              },
              {
                "expected": "accounts_phone_uq",
                "name": "phone constraint is reported",
                "observed": "accounts_phone_uq",
                "passed": true
              },
              {
                "expected": "success",
                "name": "omitted target handles usable conflict",
                "observed": "success",
                "passed": true
              },
              {
                "expected": 1,
                "name": "omitted target keeps row count",
                "observed": 1,
                "passed": true
              }
            ],
            "case_id": "on_conflict_target_scope",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.087,
            "observed": {
              "omitted_target_error": {},
              "row_counts": {
                "after_email_target": 1,
                "after_omitted_target": 1
              },
              "targeted_duplicate": {
                "column_name": null,
                "constraint_name": "accounts_phone_uq",
                "context": null,
                "datatype_name": null,
                "exception_type": "UniqueViolation",
                "internal_position": null,
                "internal_query": null,
                "message_detail": "Key (phone)=(phone-1) already exists.",
                "message_hint": null,
                "message_primary": "duplicate key value violates unique constraint \"accounts_phone_uq\"",
                "schema_name": "c23505_on_conflict_target_scope",
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "nbtinsert.c",
                "source_function": "_bt_check_unique",
                "source_line": "434",
                "sqlstate": "23505",
                "statement_position": null,
                "table_name": "accounts",
                "text": "duplicate key value violates unique constraint \"accounts_phone_uq\"\nDETAIL:  Key (phone)=(phone-1) already exists."
              },
              "targeted_status_before_rollback": "IDLE"
            },
            "schema": "c23505_on_conflict_target_scope",
            "status": "passed"
          },
          {
            "assertions": [
              {
                "expected": "23505",
                "name": "stale sequence causes natural 23505",
                "observed": "23505",
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "autocommit remains usable",
                "observed": "IDLE",
                "passed": true
              },
              {
                "expected": 7,
                "name": "sequence increment is non-default",
                "observed": 7,
                "passed": true
              },
              {
                "expected": 100,
                "name": "controlled setval repair returns max",
                "observed": 100,
                "passed": true
              },
              {
                "expected": "100 and 107",
                "name": "next value honors increment",
                "observed": [
                  [
                    100,
                    "explicit"
                  ],
                  [
                    107,
                    "after repair"
                  ]
                ],
                "passed": true
              },
              {
                "expected": "(100, true)",
                "name": "sequence was called after failed nextval",
                "observed": [
                  100,
                  true
                ],
                "passed": true
              },
              {
                "expected": "(107, true)",
                "name": "final sequence state is recorded",
                "observed": [
                  107,
                  true
                ],
                "passed": true
              }
            ],
            "case_id": "sequence_lag_repair",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.082,
            "observed": {
              "diagnostic": {
                "column_name": null,
                "constraint_name": "items_pkey",
                "context": null,
                "datatype_name": null,
                "exception_type": "UniqueViolation",
                "internal_position": null,
                "internal_query": null,
                "message_detail": "Key (id)=(100) already exists.",
                "message_hint": null,
                "message_primary": "duplicate key value violates unique constraint \"items_pkey\"",
                "schema_name": "c23505_sequence_lag_repair",
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "nbtinsert.c",
                "source_function": "_bt_check_unique",
                "source_line": "434",
                "sqlstate": "23505",
                "statement_position": null,
                "table_name": "items",
                "text": "duplicate key value violates unique constraint \"items_pkey\"\nDETAIL:  Key (id)=(100) already exists."
              },
              "max_id": 100,
              "rows": [
                [
                  100,
                  "explicit"
                ],
                [
                  107,
                  "after repair"
                ]
              ],
              "sequence": {
                "after_repair": [
                  107,
                  true
                ],
                "before_repair": [
                  100,
                  true
                ],
                "increment_by": 7,
                "relation": "\"c23505_sequence_lag_repair\".\"ids_seq\""
              }
            },
            "schema": "c23505_sequence_lag_repair",
            "status": "passed"
          }
        ]
      }
    },
    {
      "cases": [
        "log_fields"
      ],
      "id": "runtime.23505-log-fields-final-20260909.latest",
      "observed": {
        "backend_pid": 60638,
        "correlation": "Both collector records match this case backend PID, schema, table, constraint, SQLSTATE, primary message, and DETAIL.",
        "csv_record": {
          "detail": "Key (token)=(logged) already exists.",
          "message": "duplicate key value violates unique constraint \"logged_items_token_key\"",
          "process_id": "60638",
          "query": "INSERT INTO \"c23505_log_fields\".\"logged_items\" VALUES (2, 'logged')",
          "sql_state_code": "23505"
        },
        "json_record": {
          "detail": "Key (token)=(logged) already exists.",
          "message": "duplicate key value violates unique constraint \"logged_items_token_key\"",
          "pid": 60638,
          "state_code": "23505",
          "statement": "INSERT INTO \"c23505_log_fields\".\"logged_items\" VALUES (2, 'logged')"
        },
        "trigger": {
          "constraint_name": "logged_items_token_key",
          "message_detail": "Key (token)=(logged) already exists.",
          "message_primary": "duplicate key value violates unique constraint \"logged_items_token_key\"",
          "schema_name": "c23505_log_fields",
          "sqlstate": "23505",
          "table_name": "logged_items"
        }
      },
      "raw_sha256": "91945d2220cb85882275675810fb9b85382e99a6b25b2e81e6d06e7751b8553f",
      "run_id": "23505-log-fields-final-20260909",
      "server_version": "18.6 (Homebrew)",
      "server_version_num": 180006,
      "snippet_registry": {
        "sha256": "74d7d700331bc3d9c190bf807cca31999ddf45e8cbea153ec7c6b6d4f9702686"
      },
      "status": "passed",
      "summary_sha256": "4f398c31188efa509cc59f010e4cbac23751a48deac973a027ecb66903c8c817",
      "target": "latest",
      "selection_status": "selected_exact_log_correlation",
      "limits": "This targeted run is the sole selected log_fields record; its backend PID, schema, table, constraint, message, and detail match the trigger.",
      "result": {
        "status": "passed",
        "environment": {
          "TimeZone": "Asia/Shanghai",
          "backend_pid": 60623,
          "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": "23505",
                "name": "trigger sqlstate",
                "observed": "23505",
                "passed": true
              },
              {
                "expected": "23505",
                "name": "CSV exposes SQLSTATE",
                "observed": "23505",
                "passed": true
              },
              {
                "expected": "duplicate key value violates unique constraint \"logged_items_token_key\"",
                "name": "CSV exposes message",
                "observed": "duplicate key value violates unique constraint \"logged_items_token_key\"",
                "passed": true
              },
              {
                "expected": "Key (token)=(logged) already exists.",
                "name": "CSV exposes detail",
                "observed": "Key (token)=(logged) already exists.",
                "passed": true
              },
              {
                "expected": "23505",
                "name": "JSON exposes SQLSTATE",
                "observed": "23505",
                "passed": true
              },
              {
                "expected": {
                  "detail": "Key (token)=(logged) already exists.",
                  "message": "duplicate key value violates unique constraint \"logged_items_token_key\""
                },
                "name": "JSON exposes message and detail",
                "observed": {
                  "detail": "Key (token)=(logged) already exists.",
                  "message": "duplicate key value violates unique constraint \"logged_items_token_key\""
                },
                "passed": true
              },
              {
                "expected": "absent",
                "name": "logs do not claim protocol constraint_name",
                "observed": "absent",
                "passed": true
              },
              {
                "expected": {
                  "backend_pid": 60638,
                  "constraint": "logged_items_token_key",
                  "detail": "Key (token)=(logged) already exists.",
                  "message": "duplicate key value violates unique constraint \"logged_items_token_key\"",
                  "schema": "c23505_log_fields",
                  "sqlstate": "23505",
                  "table": "logged_items"
                },
                "name": "collector record is tied to this trigger",
                "observed": {
                  "backend_pid": 60638,
                  "csv": true,
                  "csv_process_id": "60638",
                  "json": true,
                  "json_process_id": 60638
                },
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "trigger connection is idle",
                "observed": "IDLE",
                "passed": true
              }
            ],
            "case_id": "log_fields",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.01,
            "observed": {
              "backend_pid": 60638,
              "csv_record": {
                "application_name": "",
                "backend_type": "client backend",
                "command_tag": "INSERT",
                "connection_from": "127.0.0.1:51136",
                "context": "",
                "database_name": "postgres",
                "detail": "Key (token)=(logged) already exists.",
                "error_severity": "ERROR",
                "hint": "",
                "internal_query": "",
                "internal_query_pos": "",
                "leader_pid": "",
                "location": "_bt_check_unique, nbtinsert.c:673",
                "log_time": "2026-09-09 17:34:17.112 CST",
                "message": "duplicate key value violates unique constraint \"logged_items_token_key\"",
                "process_id": "60638",
                "query": "INSERT INTO \"c23505_log_fields\".\"logged_items\" VALUES (2, 'logged')",
                "query_id": "0",
                "query_pos": "",
                "session_id": "6aa12819.ecde",
                "session_line_num": "1",
                "session_start_time": "2026-09-09 17:34:17 CST",
                "sql_state_code": "23505",
                "transaction_id": "755",
                "user_name": "runner",
                "virtual_transaction_id": "4/5"
              },
              "json_record": {
                "backend_type": "client backend",
                "dbname": "postgres",
                "detail": "Key (token)=(logged) already exists.",
                "error_severity": "ERROR",
                "file_line_num": 673,
                "file_name": "nbtinsert.c",
                "func_name": "_bt_check_unique",
                "line_num": 1,
                "message": "duplicate key value violates unique constraint \"logged_items_token_key\"",
                "pid": 60638,
                "ps": "INSERT",
                "query_id": 0,
                "remote_host": "127.0.0.1",
                "remote_port": 51136,
                "session_id": "6aa12819.ecde",
                "session_start": "2026-09-09 17:34:17 CST",
                "state_code": "23505",
                "statement": "INSERT INTO \"c23505_log_fields\".\"logged_items\" VALUES (2, 'logged')",
                "timestamp": "2026-09-09 17:34:17.112 CST",
                "txid": 755,
                "user": "runner",
                "vxid": "4/5"
              },
              "log_destination": "jsonlog enabled for PG15+; csvlog for all targets",
              "trigger": {
                "column_name": null,
                "constraint_name": "logged_items_token_key",
                "context": null,
                "datatype_name": null,
                "exception_type": "UniqueViolation",
                "internal_position": null,
                "internal_query": null,
                "message_detail": "Key (token)=(logged) already exists.",
                "message_hint": null,
                "message_primary": "duplicate key value violates unique constraint \"logged_items_token_key\"",
                "schema_name": "c23505_log_fields",
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "nbtinsert.c",
                "source_function": "_bt_check_unique",
                "source_line": "673",
                "sqlstate": "23505",
                "statement_position": null,
                "table_name": "logged_items",
                "text": "duplicate key value violates unique constraint \"logged_items_token_key\"\nDETAIL:  Key (token)=(logged) already exists."
              }
            },
            "schema": "c23505_log_fields",
            "status": "passed"
          }
        ]
      }
    },
    {
      "cases": [
        "log_fields"
      ],
      "id": "runtime.23505-log-fields-final-20260909.pg10",
      "image": "postgres@sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc",
      "observed": {
        "backend_pid": 81,
        "correlation": "The CSV collector record matches this case backend PID, schema, table, constraint, SQLSTATE, primary message, and DETAIL; PG10 has no JSON logging output in this target configuration.",
        "csv_record": {
          "detail": "Key (token)=(logged) already exists.",
          "message": "duplicate key value violates unique constraint \"logged_items_token_key\"",
          "process_id": "81",
          "query": "INSERT INTO \"c23505_log_fields\".\"logged_items\" VALUES (2, 'logged')",
          "sql_state_code": "23505"
        },
        "json_record": null,
        "trigger": {
          "constraint_name": "logged_items_token_key",
          "message_detail": "Key (token)=(logged) already exists.",
          "message_primary": "duplicate key value violates unique constraint \"logged_items_token_key\"",
          "schema_name": "c23505_log_fields",
          "sqlstate": "23505",
          "table_name": "logged_items"
        }
      },
      "raw_sha256": "fc52475937c24be583212464ff74a70603118680f5d39b7e2938118473223711",
      "run_id": "23505-log-fields-final-20260909",
      "server_version": "10.21 (Debian 10.21-1.pgdg90+1)",
      "server_version_num": 100021,
      "snippet_registry": {
        "sha256": "74d7d700331bc3d9c190bf807cca31999ddf45e8cbea153ec7c6b6d4f9702686"
      },
      "status": "passed",
      "summary_sha256": "d24ef7ce7c8a40cba28b0b5952b404df6feee8038a9e531062885a852b3f77e9",
      "target": "pg10",
      "selection_status": "selected_exact_log_correlation",
      "limits": "This targeted run is the sole selected log_fields record; its backend PID, schema, table, constraint, message, and detail match the trigger.",
      "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": "23505",
                "name": "trigger sqlstate",
                "observed": "23505",
                "passed": true
              },
              {
                "expected": "23505",
                "name": "CSV exposes SQLSTATE",
                "observed": "23505",
                "passed": true
              },
              {
                "expected": "duplicate key value violates unique constraint \"logged_items_token_key\"",
                "name": "CSV exposes message",
                "observed": "duplicate key value violates unique constraint \"logged_items_token_key\"",
                "passed": true
              },
              {
                "expected": "Key (token)=(logged) already exists.",
                "name": "CSV exposes detail",
                "observed": "Key (token)=(logged) already exists.",
                "passed": true
              },
              {
                "expected": "not present",
                "name": "JSON is outside PG10 target",
                "observed": null,
                "passed": true
              },
              {
                "expected": {
                  "backend_pid": 81,
                  "constraint": "logged_items_token_key",
                  "detail": "Key (token)=(logged) already exists.",
                  "message": "duplicate key value violates unique constraint \"logged_items_token_key\"",
                  "schema": "c23505_log_fields",
                  "sqlstate": "23505",
                  "table": "logged_items"
                },
                "name": "collector record is tied to this trigger",
                "observed": {
                  "backend_pid": 81,
                  "csv": true,
                  "csv_process_id": "81",
                  "json": false,
                  "json_process_id": null
                },
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "trigger connection is idle",
                "observed": "IDLE",
                "passed": true
              }
            ],
            "case_id": "log_fields",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.09,
            "observed": {
              "backend_pid": 81,
              "csv_record": {
                "application_name": "",
                "command_tag": "INSERT",
                "connection_from": "172.17.0.1:61708",
                "context": "",
                "database_name": "postgres",
                "detail": "Key (token)=(logged) already exists.",
                "error_severity": "ERROR",
                "hint": "",
                "internal_query": "",
                "internal_query_pos": "",
                "location": "_bt_check_unique, nbtinsert.c:434",
                "log_time": "2026-09-09 09:34:21.619 UTC",
                "message": "duplicate key value violates unique constraint \"logged_items_token_key\"",
                "process_id": "81",
                "query": "INSERT INTO \"c23505_log_fields\".\"logged_items\" VALUES (2, 'logged')",
                "query_pos": "",
                "session_id": "6aa1281d.51",
                "session_line_num": "1",
                "session_start_time": "2026-09-09 09:34:21 UTC",
                "sql_state_code": "23505",
                "transaction_id": "559",
                "user_name": "postgres",
                "virtual_transaction_id": "3/27"
              },
              "json_record": null,
              "log_destination": "jsonlog enabled for PG15+; csvlog for all targets",
              "trigger": {
                "column_name": null,
                "constraint_name": "logged_items_token_key",
                "context": null,
                "datatype_name": null,
                "exception_type": "UniqueViolation",
                "internal_position": null,
                "internal_query": null,
                "message_detail": "Key (token)=(logged) already exists.",
                "message_hint": null,
                "message_primary": "duplicate key value violates unique constraint \"logged_items_token_key\"",
                "schema_name": "c23505_log_fields",
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "nbtinsert.c",
                "source_function": "_bt_check_unique",
                "source_line": "434",
                "sqlstate": "23505",
                "statement_position": null,
                "table_name": "logged_items",
                "text": "duplicate key value violates unique constraint \"logged_items_token_key\"\nDETAIL:  Key (token)=(logged) already exists."
              }
            },
            "schema": "c23505_log_fields",
            "status": "passed"
          }
        ]
      }
    },
    {
      "cases": [
        "dml_unique_conflict"
      ],
      "id": "runtime.23505-diagnostic-snippet-20260909.latest",
      "run_id": "23505-diagnostic-snippet-20260909",
      "server_version": "18.6 (Homebrew)",
      "server_version_num": 180006,
      "status": "passed",
      "target": "latest",
      "selection_status": "selected_for_dml_diagnostic",
      "limits": "The selected DML diagnostic case is the targeted registry run; the broad base-run copy is retained only as local audit data.",
      "result": {
        "status": "passed",
        "environment": {
          "TimeZone": "Asia/Shanghai",
          "backend_pid": 94802,
          "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": "23505",
                "name": "sqlstate",
                "observed": "23505",
                "passed": true
              },
              {
                "expected": true,
                "name": "message identifies unique violation",
                "observed": "duplicate key value violates unique constraint \"users_email_key\"",
                "passed": true
              },
              {
                "expected": true,
                "name": "detail identifies key",
                "observed": "Key (email)=(a@example.test) already exists.",
                "passed": true
              },
              {
                "expected": "c23505_dml_unique_conflict",
                "name": "protocol schema",
                "observed": "c23505_dml_unique_conflict",
                "passed": true
              },
              {
                "expected": "users",
                "name": "protocol table",
                "observed": "users",
                "passed": true
              },
              {
                "expected": "a constraint name",
                "name": "protocol constraint",
                "observed": "users_email_key",
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "autocommit connection is idle",
                "observed": "IDLE",
                "passed": true
              },
              {
                "expected": "error",
                "name": "failure was not an unexpected success",
                "observed": "error",
                "passed": true
              },
              {
                "expected": "at least one row",
                "name": "catalog constraint query returns definitions",
                "observed": [
                  [
                    "accounts_id_not_null",
                    "n",
                    false,
                    false,
                    "NOT NULL id"
                  ],
                  [
                    "accounts_email_not_null",
                    "n",
                    false,
                    false,
                    "NOT NULL email"
                  ],
                  [
                    "accounts_pkey",
                    "p",
                    false,
                    false,
                    "PRIMARY KEY (id)"
                  ],
                  [
                    "accounts_email_key",
                    "u",
                    false,
                    false,
                    "UNIQUE (email)"
                  ]
                ],
                "passed": true
              },
              {
                "expected": "at least one row",
                "name": "catalog index query returns definitions",
                "observed": [
                  [
                    "c23505_dml_unique_conflict.accounts_pkey",
                    true,
                    true,
                    true,
                    true,
                    "CREATE UNIQUE INDEX accounts_pkey ON c23505_dml_unique_conflict.accounts USING btree (id)"
                  ],
                  [
                    "c23505_dml_unique_conflict.accounts_email_key",
                    true,
                    true,
                    true,
                    true,
                    "CREATE UNIQUE INDEX accounts_email_key ON c23505_dml_unique_conflict.accounts USING btree (email)"
                  ]
                ],
                "passed": true
              }
            ],
            "case_id": "dml_unique_conflict",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.012,
            "observed": {
              "catalog_queries": {
                "constraints": [
                  [
                    "accounts_id_not_null",
                    "n",
                    false,
                    false,
                    "NOT NULL id"
                  ],
                  [
                    "accounts_email_not_null",
                    "n",
                    false,
                    false,
                    "NOT NULL email"
                  ],
                  [
                    "accounts_pkey",
                    "p",
                    false,
                    false,
                    "PRIMARY KEY (id)"
                  ],
                  [
                    "accounts_email_key",
                    "u",
                    false,
                    false,
                    "UNIQUE (email)"
                  ]
                ],
                "indexes": [
                  [
                    "c23505_dml_unique_conflict.accounts_pkey",
                    true,
                    true,
                    true,
                    true,
                    "CREATE UNIQUE INDEX accounts_pkey ON c23505_dml_unique_conflict.accounts USING btree (id)"
                  ],
                  [
                    "c23505_dml_unique_conflict.accounts_email_key",
                    true,
                    true,
                    true,
                    true,
                    "CREATE UNIQUE INDEX accounts_email_key ON c23505_dml_unique_conflict.accounts USING btree (email)"
                  ]
                ]
              },
              "diagnostic": {
                "column_name": null,
                "constraint_name": "users_email_key",
                "context": null,
                "datatype_name": null,
                "exception_type": "UniqueViolation",
                "internal_position": null,
                "internal_query": null,
                "message_detail": "Key (email)=(a@example.test) already exists.",
                "message_hint": null,
                "message_primary": "duplicate key value violates unique constraint \"users_email_key\"",
                "schema_name": "c23505_dml_unique_conflict",
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "nbtinsert.c",
                "source_function": "_bt_check_unique",
                "source_line": "673",
                "sqlstate": "23505",
                "statement_position": null,
                "table_name": "users",
                "text": "duplicate key value violates unique constraint \"users_email_key\"\nDETAIL:  Key (email)=(a@example.test) already exists."
              },
              "transaction_status_after": "IDLE"
            },
            "schema": "c23505_dml_unique_conflict",
            "status": "passed"
          }
        ]
      }
    },
    {
      "cases": [
        "dml_unique_conflict"
      ],
      "id": "runtime.23505-diagnostic-snippet-20260909.pg10",
      "run_id": "23505-diagnostic-snippet-20260909",
      "server_version": "10.21 (Debian 10.21-1.pgdg90+1)",
      "server_version_num": 100021,
      "status": "passed",
      "target": "pg10",
      "selection_status": "selected_for_dml_diagnostic",
      "limits": "The selected DML diagnostic case is the targeted registry run; the broad base-run copy is retained only as local audit data.",
      "result": {
        "status": "passed",
        "environment": {
          "TimeZone": "Etc/UTC",
          "backend_pid": 78,
          "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": "23505",
                "name": "sqlstate",
                "observed": "23505",
                "passed": true
              },
              {
                "expected": true,
                "name": "message identifies unique violation",
                "observed": "duplicate key value violates unique constraint \"users_email_key\"",
                "passed": true
              },
              {
                "expected": true,
                "name": "detail identifies key",
                "observed": "Key (email)=(a@example.test) already exists.",
                "passed": true
              },
              {
                "expected": "c23505_dml_unique_conflict",
                "name": "protocol schema",
                "observed": "c23505_dml_unique_conflict",
                "passed": true
              },
              {
                "expected": "users",
                "name": "protocol table",
                "observed": "users",
                "passed": true
              },
              {
                "expected": "a constraint name",
                "name": "protocol constraint",
                "observed": "users_email_key",
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "autocommit connection is idle",
                "observed": "IDLE",
                "passed": true
              },
              {
                "expected": "error",
                "name": "failure was not an unexpected success",
                "observed": "error",
                "passed": true
              },
              {
                "expected": "at least one row",
                "name": "catalog constraint query returns definitions",
                "observed": [
                  [
                    "accounts_pkey",
                    "p",
                    false,
                    false,
                    "PRIMARY KEY (id)"
                  ],
                  [
                    "accounts_email_key",
                    "u",
                    false,
                    false,
                    "UNIQUE (email)"
                  ]
                ],
                "passed": true
              },
              {
                "expected": "at least one row",
                "name": "catalog index query returns definitions",
                "observed": [
                  [
                    "c23505_dml_unique_conflict.accounts_pkey",
                    true,
                    true,
                    true,
                    true,
                    "CREATE UNIQUE INDEX accounts_pkey ON c23505_dml_unique_conflict.accounts USING btree (id)"
                  ],
                  [
                    "c23505_dml_unique_conflict.accounts_email_key",
                    true,
                    true,
                    true,
                    true,
                    "CREATE UNIQUE INDEX accounts_email_key ON c23505_dml_unique_conflict.accounts USING btree (email)"
                  ]
                ],
                "passed": true
              }
            ],
            "case_id": "dml_unique_conflict",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.019,
            "observed": {
              "catalog_queries": {
                "constraints": [
                  [
                    "accounts_pkey",
                    "p",
                    false,
                    false,
                    "PRIMARY KEY (id)"
                  ],
                  [
                    "accounts_email_key",
                    "u",
                    false,
                    false,
                    "UNIQUE (email)"
                  ]
                ],
                "indexes": [
                  [
                    "c23505_dml_unique_conflict.accounts_pkey",
                    true,
                    true,
                    true,
                    true,
                    "CREATE UNIQUE INDEX accounts_pkey ON c23505_dml_unique_conflict.accounts USING btree (id)"
                  ],
                  [
                    "c23505_dml_unique_conflict.accounts_email_key",
                    true,
                    true,
                    true,
                    true,
                    "CREATE UNIQUE INDEX accounts_email_key ON c23505_dml_unique_conflict.accounts USING btree (email)"
                  ]
                ]
              },
              "diagnostic": {
                "column_name": null,
                "constraint_name": "users_email_key",
                "context": null,
                "datatype_name": null,
                "exception_type": "UniqueViolation",
                "internal_position": null,
                "internal_query": null,
                "message_detail": "Key (email)=(a@example.test) already exists.",
                "message_hint": null,
                "message_primary": "duplicate key value violates unique constraint \"users_email_key\"",
                "schema_name": "c23505_dml_unique_conflict",
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "nbtinsert.c",
                "source_function": "_bt_check_unique",
                "source_line": "434",
                "sqlstate": "23505",
                "statement_position": null,
                "table_name": "users",
                "text": "duplicate key value violates unique constraint \"users_email_key\"\nDETAIL:  Key (email)=(a@example.test) already exists."
              },
              "transaction_status_after": "IDLE"
            },
            "schema": "c23505_dml_unique_conflict",
            "status": "passed"
          }
        ]
      }
    },
    {
      "cases": [
        "explicit_tx_abort_recovery"
      ],
      "id": "runtime.23505-explicit-manual-final-20260909.latest",
      "limits": "This run proves that registry transaction statements execute with autocommit=True, so psycopg does not add an implicit BEGIN; it covers this explicit recovery case only.",
      "observed": {
        "connection_autocommit": true,
        "duplicate_sqlstate": "23505",
        "repair_transaction": "BEGIN; INSERT; COMMIT",
        "rows": [
          [
            1,
            "seed"
          ],
          [
            2,
            "after rollback"
          ]
        ],
        "status_after_25p02": "INERROR",
        "status_after_duplicate": "INERROR",
        "status_after_rollback": "IDLE",
        "transaction_control": [
          "BEGIN",
          "ROLLBACK",
          "BEGIN",
          "COMMIT"
        ]
      },
      "raw_sha256": "586bacd10d1e5d2a5a5ec58c2ed747d4b2b8618a051ce56b0d8307c7265e196d",
      "run_id": "23505-explicit-manual-final-20260909",
      "server_version": "18.6 (Homebrew)",
      "server_version_num": 180006,
      "snippet_registry": {
        "sha256": "74d7d700331bc3d9c190bf807cca31999ddf45e8cbea153ec7c6b6d4f9702686"
      },
      "status": "passed",
      "summary_sha256": "38cd0161a97fa35084f192a5aa60f6061955b60ec681c4800b575514dee6a6f3",
      "target": "latest",
      "selection_status": "selected_manual_boundary",
      "result": {
        "status": "passed",
        "environment": {
          "TimeZone": "Asia/Shanghai",
          "backend_pid": 90174,
          "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": "23505",
                "name": "duplicate sqlstate",
                "observed": "23505",
                "passed": true
              },
              {
                "expected": "INERROR",
                "name": "failed explicit transaction is inerror",
                "observed": "INERROR",
                "passed": true
              },
              {
                "expected": "25P02",
                "name": "next statement is 25P02",
                "observed": "25P02",
                "passed": true
              },
              {
                "expected": "INERROR",
                "name": "next statement leaves transaction inerror",
                "observed": "INERROR",
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "rollback restores idle",
                "observed": "IDLE",
                "passed": true
              },
              {
                "expected": "error",
                "name": "next statement really failed",
                "observed": "error",
                "passed": true
              },
              {
                "expected": "two valid rows",
                "name": "repair row committed",
                "observed": [
                  [
                    1,
                    "seed"
                  ],
                  [
                    2,
                    "after rollback"
                  ]
                ],
                "passed": true
              }
            ],
            "case_id": "explicit_tx_abort_recovery",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.025,
            "observed": {
              "aborted_transaction": {
                "column_name": null,
                "constraint_name": null,
                "context": null,
                "datatype_name": null,
                "exception_type": "InFailedSqlTransaction",
                "internal_position": null,
                "internal_query": null,
                "message_detail": null,
                "message_hint": null,
                "message_primary": "current transaction is aborted, commands ignored until end of transaction block",
                "schema_name": null,
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "postgres.c",
                "source_function": "exec_simple_query",
                "source_line": "1140",
                "sqlstate": "25P02",
                "statement_position": null,
                "table_name": null,
                "text": "current transaction is aborted, commands ignored until end of transaction block"
              },
              "connection_autocommit": true,
              "duplicate": {
                "column_name": null,
                "constraint_name": "items_note_key",
                "context": null,
                "datatype_name": null,
                "exception_type": "UniqueViolation",
                "internal_position": null,
                "internal_query": null,
                "message_detail": "Key (note)=(seed) already exists.",
                "message_hint": null,
                "message_primary": "duplicate key value violates unique constraint \"items_note_key\"",
                "schema_name": "c23505_explicit_tx_abort_recovery",
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "nbtinsert.c",
                "source_function": "_bt_check_unique",
                "source_line": "673",
                "sqlstate": "23505",
                "statement_position": null,
                "table_name": "items",
                "text": "duplicate key value violates unique constraint \"items_note_key\"\nDETAIL:  Key (note)=(seed) already exists."
              },
              "rows": [
                [
                  1,
                  "seed"
                ],
                [
                  2,
                  "after rollback"
                ]
              ],
              "statuses": {
                "after_25p02": "INERROR",
                "after_duplicate": "INERROR",
                "after_rollback": "IDLE"
              },
              "transaction_control": [
                "BEGIN",
                "ROLLBACK",
                "BEGIN",
                "COMMIT"
              ]
            },
            "schema": "c23505_explicit_tx_abort_recovery",
            "status": "passed"
          }
        ]
      }
    },
    {
      "cases": [
        "explicit_tx_abort_recovery"
      ],
      "id": "runtime.23505-explicit-manual-final-20260909.pg10",
      "image": "postgres@sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc",
      "limits": "This run proves that registry transaction statements execute with autocommit=True, so psycopg does not add an implicit BEGIN; it covers this explicit recovery case only.",
      "observed": {
        "connection_autocommit": true,
        "duplicate_sqlstate": "23505",
        "repair_transaction": "BEGIN; INSERT; COMMIT",
        "rows": [
          [
            1,
            "seed"
          ],
          [
            2,
            "after rollback"
          ]
        ],
        "status_after_25p02": "INERROR",
        "status_after_duplicate": "INERROR",
        "status_after_rollback": "IDLE",
        "transaction_control": [
          "BEGIN",
          "ROLLBACK",
          "BEGIN",
          "COMMIT"
        ]
      },
      "raw_sha256": "ed1c4f5082a00b67297a9d01b8362f7d70c758a2fbd393e20def6c450a6f5739",
      "run_id": "23505-explicit-manual-final-20260909",
      "server_version": "10.21 (Debian 10.21-1.pgdg90+1)",
      "server_version_num": 100021,
      "snippet_registry": {
        "sha256": "74d7d700331bc3d9c190bf807cca31999ddf45e8cbea153ec7c6b6d4f9702686"
      },
      "status": "passed",
      "summary_sha256": "4a4243d367afd9c142991aba496336c972e4fe3cc959a724d3454773986ac30b",
      "target": "pg10",
      "selection_status": "selected_manual_boundary",
      "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": "23505",
                "name": "duplicate sqlstate",
                "observed": "23505",
                "passed": true
              },
              {
                "expected": "INERROR",
                "name": "failed explicit transaction is inerror",
                "observed": "INERROR",
                "passed": true
              },
              {
                "expected": "25P02",
                "name": "next statement is 25P02",
                "observed": "25P02",
                "passed": true
              },
              {
                "expected": "INERROR",
                "name": "next statement leaves transaction inerror",
                "observed": "INERROR",
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "rollback restores idle",
                "observed": "IDLE",
                "passed": true
              },
              {
                "expected": "error",
                "name": "next statement really failed",
                "observed": "error",
                "passed": true
              },
              {
                "expected": "two valid rows",
                "name": "repair row committed",
                "observed": [
                  [
                    1,
                    "seed"
                  ],
                  [
                    2,
                    "after rollback"
                  ]
                ],
                "passed": true
              }
            ],
            "case_id": "explicit_tx_abort_recovery",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.022,
            "observed": {
              "aborted_transaction": {
                "column_name": null,
                "constraint_name": null,
                "context": null,
                "datatype_name": null,
                "exception_type": "InFailedSqlTransaction",
                "internal_position": null,
                "internal_query": null,
                "message_detail": null,
                "message_hint": null,
                "message_primary": "current transaction is aborted, commands ignored until end of transaction block",
                "schema_name": null,
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "postgres.c",
                "source_function": "exec_simple_query",
                "source_line": "1022",
                "sqlstate": "25P02",
                "statement_position": null,
                "table_name": null,
                "text": "current transaction is aborted, commands ignored until end of transaction block"
              },
              "connection_autocommit": true,
              "duplicate": {
                "column_name": null,
                "constraint_name": "items_note_key",
                "context": null,
                "datatype_name": null,
                "exception_type": "UniqueViolation",
                "internal_position": null,
                "internal_query": null,
                "message_detail": "Key (note)=(seed) already exists.",
                "message_hint": null,
                "message_primary": "duplicate key value violates unique constraint \"items_note_key\"",
                "schema_name": "c23505_explicit_tx_abort_recovery",
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "nbtinsert.c",
                "source_function": "_bt_check_unique",
                "source_line": "434",
                "sqlstate": "23505",
                "statement_position": null,
                "table_name": "items",
                "text": "duplicate key value violates unique constraint \"items_note_key\"\nDETAIL:  Key (note)=(seed) already exists."
              },
              "rows": [
                [
                  1,
                  "seed"
                ],
                [
                  2,
                  "after rollback"
                ]
              ],
              "statuses": {
                "after_25p02": "INERROR",
                "after_duplicate": "INERROR",
                "after_rollback": "IDLE"
              },
              "transaction_control": [
                "BEGIN",
                "ROLLBACK",
                "BEGIN",
                "COMMIT"
              ]
            },
            "schema": "c23505_explicit_tx_abort_recovery",
            "status": "passed"
          }
        ]
      }
    },
    {
      "cases": [
        "savepoint_recovery"
      ],
      "id": "runtime.23505-savepoint-manual-final-20260909.latest",
      "limits": "This run proves the registry savepoint sequence executes with autocommit=True, so psycopg does not add an implicit BEGIN; it covers savepoint recovery only.",
      "observed": {
        "connection_autocommit": true,
        "statuses": {
          "after_duplicate": "INERROR",
          "after_rollback_to_savepoint": "INTRANS"
        },
        "transaction_control": [
          "BEGIN",
          "SAVEPOINT",
          "ROLLBACK TO SAVEPOINT",
          "RELEASE SAVEPOINT",
          "COMMIT"
        ],
        "rows": [
          [
            1,
            "seed"
          ],
          [
            2,
            "outer"
          ],
          [
            3,
            "after savepoint"
          ]
        ]
      },
      "raw_sha256": "3b3e7305df8d70309f3c632e9b19b43cd9f1411f0967e952bff7997e5c0c7cb7",
      "run_id": "23505-savepoint-manual-final-20260909",
      "server_version": "18.6 (Homebrew)",
      "server_version_num": 180006,
      "snippet_registry": {
        "sha256": "74d7d700331bc3d9c190bf807cca31999ddf45e8cbea153ec7c6b6d4f9702686"
      },
      "status": "passed",
      "summary_sha256": "e9ff818a677f577321fb2faccb8d48bb62b054d9f579531a5231029cb16162ef",
      "target": "latest",
      "selection_status": "selected_manual_boundary",
      "result": {
        "status": "passed",
        "environment": {
          "TimeZone": "Asia/Shanghai",
          "backend_pid": 8343,
          "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": "23505",
                "name": "duplicate sqlstate",
                "observed": "23505",
                "passed": true
              },
              {
                "expected": "INERROR",
                "name": "savepoint subtransaction is inerror",
                "observed": "INERROR",
                "passed": true
              },
              {
                "expected": "25P02",
                "name": "statement before rollback is 25P02",
                "observed": "25P02",
                "passed": true
              },
              {
                "expected": "INTRANS",
                "name": "rollback to savepoint restores intrans",
                "observed": "INTRANS",
                "passed": true
              },
              {
                "expected": "three rows",
                "name": "statements before savepoint survive",
                "observed": [
                  [
                    1,
                    "seed"
                  ],
                  [
                    2,
                    "outer"
                  ],
                  [
                    3,
                    "after savepoint"
                  ]
                ],
                "passed": true
              },
              {
                "expected": "two errors",
                "name": "expected duplicate was raised",
                "observed": {
                  "25p02": true,
                  "duplicate": true
                },
                "passed": true
              }
            ],
            "case_id": "savepoint_recovery",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.014,
            "observed": {
              "aborted_transaction": {
                "column_name": null,
                "constraint_name": null,
                "context": null,
                "datatype_name": null,
                "exception_type": "InFailedSqlTransaction",
                "internal_position": null,
                "internal_query": null,
                "message_detail": null,
                "message_hint": null,
                "message_primary": "current transaction is aborted, commands ignored until end of transaction block",
                "schema_name": null,
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "postgres.c",
                "source_function": "exec_simple_query",
                "source_line": "1140",
                "sqlstate": "25P02",
                "statement_position": null,
                "table_name": null,
                "text": "current transaction is aborted, commands ignored until end of transaction block"
              },
              "connection_autocommit": true,
              "duplicate": {
                "column_name": null,
                "constraint_name": "items_note_key",
                "context": null,
                "datatype_name": null,
                "exception_type": "UniqueViolation",
                "internal_position": null,
                "internal_query": null,
                "message_detail": "Key (note)=(seed) already exists.",
                "message_hint": null,
                "message_primary": "duplicate key value violates unique constraint \"items_note_key\"",
                "schema_name": "c23505_savepoint_recovery",
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "nbtinsert.c",
                "source_function": "_bt_check_unique",
                "source_line": "673",
                "sqlstate": "23505",
                "statement_position": null,
                "table_name": "items",
                "text": "duplicate key value violates unique constraint \"items_note_key\"\nDETAIL:  Key (note)=(seed) already exists."
              },
              "rows": [
                [
                  1,
                  "seed"
                ],
                [
                  2,
                  "outer"
                ],
                [
                  3,
                  "after savepoint"
                ]
              ],
              "statuses": {
                "after_duplicate": "INERROR",
                "after_rollback_to_savepoint": "INTRANS"
              },
              "transaction_control": [
                "BEGIN",
                "SAVEPOINT",
                "ROLLBACK TO SAVEPOINT",
                "RELEASE SAVEPOINT",
                "COMMIT"
              ]
            },
            "schema": "c23505_savepoint_recovery",
            "status": "passed"
          }
        ]
      }
    },
    {
      "cases": [
        "savepoint_recovery"
      ],
      "id": "runtime.23505-savepoint-manual-final-20260909.pg10",
      "image": "postgres@sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc",
      "limits": "This run proves the registry savepoint sequence executes with autocommit=True, so psycopg does not add an implicit BEGIN; it covers savepoint recovery only.",
      "observed": {
        "connection_autocommit": true,
        "statuses": {
          "after_duplicate": "INERROR",
          "after_rollback_to_savepoint": "INTRANS"
        },
        "transaction_control": [
          "BEGIN",
          "SAVEPOINT",
          "ROLLBACK TO SAVEPOINT",
          "RELEASE SAVEPOINT",
          "COMMIT"
        ],
        "rows": [
          [
            1,
            "seed"
          ],
          [
            2,
            "outer"
          ],
          [
            3,
            "after savepoint"
          ]
        ]
      },
      "raw_sha256": "74fb5d36973e351dead8e49c02f2e272979c0dae5d40fc6b631a9ea6f25c5742",
      "run_id": "23505-savepoint-manual-final-20260909",
      "server_version": "10.21 (Debian 10.21-1.pgdg90+1)",
      "server_version_num": 100021,
      "snippet_registry": {
        "sha256": "74d7d700331bc3d9c190bf807cca31999ddf45e8cbea153ec7c6b6d4f9702686"
      },
      "status": "passed",
      "summary_sha256": "9f6dea66d73191045e35fe239ecff2c69fb046bdd90de5cc4351443f3bc0f4bf",
      "target": "pg10",
      "selection_status": "selected_manual_boundary",
      "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": "23505",
                "name": "duplicate sqlstate",
                "observed": "23505",
                "passed": true
              },
              {
                "expected": "INERROR",
                "name": "savepoint subtransaction is inerror",
                "observed": "INERROR",
                "passed": true
              },
              {
                "expected": "25P02",
                "name": "statement before rollback is 25P02",
                "observed": "25P02",
                "passed": true
              },
              {
                "expected": "INTRANS",
                "name": "rollback to savepoint restores intrans",
                "observed": "INTRANS",
                "passed": true
              },
              {
                "expected": "three rows",
                "name": "statements before savepoint survive",
                "observed": [
                  [
                    1,
                    "seed"
                  ],
                  [
                    2,
                    "outer"
                  ],
                  [
                    3,
                    "after savepoint"
                  ]
                ],
                "passed": true
              },
              {
                "expected": "two errors",
                "name": "expected duplicate was raised",
                "observed": {
                  "25p02": true,
                  "duplicate": true
                },
                "passed": true
              }
            ],
            "case_id": "savepoint_recovery",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.021,
            "observed": {
              "aborted_transaction": {
                "column_name": null,
                "constraint_name": null,
                "context": null,
                "datatype_name": null,
                "exception_type": "InFailedSqlTransaction",
                "internal_position": null,
                "internal_query": null,
                "message_detail": null,
                "message_hint": null,
                "message_primary": "current transaction is aborted, commands ignored until end of transaction block",
                "schema_name": null,
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "postgres.c",
                "source_function": "exec_simple_query",
                "source_line": "1022",
                "sqlstate": "25P02",
                "statement_position": null,
                "table_name": null,
                "text": "current transaction is aborted, commands ignored until end of transaction block"
              },
              "connection_autocommit": true,
              "duplicate": {
                "column_name": null,
                "constraint_name": "items_note_key",
                "context": null,
                "datatype_name": null,
                "exception_type": "UniqueViolation",
                "internal_position": null,
                "internal_query": null,
                "message_detail": "Key (note)=(seed) already exists.",
                "message_hint": null,
                "message_primary": "duplicate key value violates unique constraint \"items_note_key\"",
                "schema_name": "c23505_savepoint_recovery",
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "nbtinsert.c",
                "source_function": "_bt_check_unique",
                "source_line": "434",
                "sqlstate": "23505",
                "statement_position": null,
                "table_name": "items",
                "text": "duplicate key value violates unique constraint \"items_note_key\"\nDETAIL:  Key (note)=(seed) already exists."
              },
              "rows": [
                [
                  1,
                  "seed"
                ],
                [
                  2,
                  "outer"
                ],
                [
                  3,
                  "after savepoint"
                ]
              ],
              "statuses": {
                "after_duplicate": "INERROR",
                "after_rollback_to_savepoint": "INTRANS"
              },
              "transaction_control": [
                "BEGIN",
                "SAVEPOINT",
                "ROLLBACK TO SAVEPOINT",
                "RELEASE SAVEPOINT",
                "COMMIT"
              ]
            },
            "schema": "c23505_savepoint_recovery",
            "status": "passed"
          }
        ]
      }
    },
    {
      "id": "runtime.23505-boundary-pg14-20260909.pg14",
      "run_id": "23505-boundary-pg14-20260909",
      "target": "pg14",
      "server_version": "14.24 (Debian 14.24-1.pgdg13+2)",
      "server_version_num": 140024,
      "status": "not_applicable",
      "case_status": "passed",
      "target_status": "passed",
      "cases": [
        "nulls_not_distinct_version_boundary"
      ],
      "summary_sha256": "e757ffaea0ee44d8f5ee5f4187798809d0c63a40020ff575a763e4cabb960f75",
      "raw_sha256": "d21fcb5f18c65a8e941814b8c4046b84700c59ce14b73ced51d2f8ac574552fc",
      "snippet_registry": {
        "sha256": "2535a5a74138b3e7896f1d06e1109be42f62a49b4dac25e3f842d60c30b21a95"
      },
      "case_manifest": {
        "sha256": "e4d9376fa038675dcfd83c3fb3590b2bc43bb897dd5521be11474a7df0334776"
      },
      "observed": {
        "ordinary_unique_null_count": 2,
        "explicit_feature": "unsupported_syntax",
        "unsupported_sqlstate": "42601",
        "unsupported_severity": "ERROR",
        "unsupported_primary": "syntax error at or near \"NULLS\"",
        "status_after_syntax": "IDLE",
        "natural_23505_observed": false
      },
      "selection_status": "selected_boundary_comparison",
      "limits": "The same registry case passed its assertions, but this target cannot execute the explicit feature. Its 42601 result is retained as a version-availability comparison and is not counted as an observed 23505 runtime.",
      "result": {
        "status": "passed",
        "environment": {
          "TimeZone": "Etc/UTC",
          "backend_pid": 73,
          "binary": {},
          "connection_scope": "runner-owned localhost port",
          "current_user": "postgres",
          "docker": {
            "architecture": "arm64",
            "command": "/usr/local/bin/docker",
            "digest": "sha256:156f0b253fd61366d5fc2107ad45955027d5612f695a8436ce20167f3fa79bff",
            "id": "sha256:156f0b253fd61366d5fc2107ad45955027d5612f695a8436ce20167f3fa79bff",
            "image": "postgres:14.24",
            "image_created": "2026-08-25T00:44:48.501682245Z",
            "image_ref": "postgres@sha256:156f0b253fd61366d5fc2107ad45955027d5612f695a8436ce20167f3fa79bff",
            "log_destination": "csvlog",
            "os": "linux",
            "repo_digests": [
              "postgres@sha256:156f0b253fd61366d5fc2107ad45955027d5612f695a8436ce20167f3fa79bff"
            ]
          },
          "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": "14.24 (Debian 14.24-1.pgdg13+2)",
          "server_version_num": "140024",
          "target_kind": "docker-version",
          "wal_level": "logical"
        },
        "cases": [
          {
            "assertions": [
              {
                "expected": 2,
                "name": "ordinary UNIQUE accepts two NULLs",
                "observed": 2,
                "passed": true
              },
              {
                "expected": "syntax error 42601 and IDLE",
                "name": "PG14 executes and rejects NULLS NOT DISTINCT syntax",
                "observed": {
                  "error": {
                    "column_name": null,
                    "constraint_name": null,
                    "context": null,
                    "datatype_name": null,
                    "exception_type": "SyntaxError",
                    "internal_position": null,
                    "internal_query": null,
                    "message_detail": null,
                    "message_hint": null,
                    "message_primary": "syntax error at or near \"NULLS\"",
                    "schema_name": null,
                    "severity": "ERROR",
                    "severity_nonlocalized": "ERROR",
                    "source_file": "scan.l",
                    "source_function": "scanner_yyerror",
                    "source_line": "1176",
                    "sqlstate": "42601",
                    "statement_position": "138",
                    "table_name": null,
                    "text": "syntax error at or near \"NULLS\"\nLINE 1: ... integer, CONSTRAINT nulls_not_distinct_uq UNIQUE NULLS NOT ...\n                                                             ^"
                  },
                  "status": "IDLE"
                },
                "passed": true
              }
            ],
            "case_id": "nulls_not_distinct_version_boundary",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.035,
            "observed": {
              "comparison_limit": "PG14 syntax observation is not counted as 23505 coverage",
              "explicit_feature": "unsupported_syntax",
              "natural_23505_observed": false,
              "ordinary_unique": {
                "null_count": 2
              },
              "status_after_syntax": "IDLE",
              "unsupported_syntax": {
                "column_name": null,
                "constraint_name": null,
                "context": null,
                "datatype_name": null,
                "exception_type": "SyntaxError",
                "internal_position": null,
                "internal_query": null,
                "message_detail": null,
                "message_hint": null,
                "message_primary": "syntax error at or near \"NULLS\"",
                "schema_name": null,
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "scan.l",
                "source_function": "scanner_yyerror",
                "source_line": "1176",
                "sqlstate": "42601",
                "statement_position": "138",
                "table_name": null,
                "text": "syntax error at or near \"NULLS\"\nLINE 1: ... integer, CONSTRAINT nulls_not_distinct_uq UNIQUE NULLS NOT ...\n                                                             ^"
              }
            },
            "schema": "c23505_nulls_not_distinct_version_boundary",
            "status": "passed"
          }
        ]
      }
    },
    {
      "id": "runtime.23505-boundary-pg15-20260909.pg15",
      "run_id": "23505-boundary-pg15-20260909",
      "target": "pg15",
      "server_version": "15.19 (Debian 15.19-1.pgdg13+2)",
      "server_version_num": 150019,
      "status": "passed",
      "case_status": "passed",
      "target_status": "passed",
      "cases": [
        "nulls_not_distinct_version_boundary"
      ],
      "summary_sha256": "df4d1f90eaca2155359bc7b141734a1026d7e1893400e5e6352ac1e95461137d",
      "raw_sha256": "d2bd7a499b4c9355f209e0831b3dbba8bcc98c8149010dcc9f13135ae05ed97a",
      "snippet_registry": {
        "sha256": "2535a5a74138b3e7896f1d06e1109be42f62a49b4dac25e3f842d60c30b21a95"
      },
      "case_manifest": {
        "sha256": "e4d9376fa038675dcfd83c3fb3590b2bc43bb897dd5521be11474a7df0334776"
      },
      "observed": {
        "ordinary_unique_null_count": 2,
        "explicit_feature": "supported",
        "explicit_sqlstate": "23505",
        "explicit_severity": "ERROR",
        "explicit_constraint": "nulls_not_distinct_uq",
        "explicit_primary": "duplicate key value violates unique constraint \"nulls_not_distinct_uq\"",
        "explicit_detail": "Key (external_id)=(null) already exists.",
        "status_after_duplicate": "IDLE",
        "repaired_row_count": 2,
        "natural_23505_observed": true
      },
      "selection_status": "selected_boundary_comparison",
      "limits": "This is a separate PG15 boundary comparison for the explicit NULLS NOT DISTINCT case; it does not replace or inflate the selected base runtime cases.",
      "result": {
        "status": "passed",
        "environment": {
          "TimeZone": "Etc/UTC",
          "backend_pid": 71,
          "binary": {},
          "connection_scope": "runner-owned localhost port",
          "current_user": "postgres",
          "docker": {
            "architecture": "arm64",
            "command": "/usr/local/bin/docker",
            "digest": "sha256:9b1d34adbce1dd07ee6e94b4a2cf698884b89bd44a6c9c12f5da8f3acbfe4957",
            "id": "sha256:9b1d34adbce1dd07ee6e94b4a2cf698884b89bd44a6c9c12f5da8f3acbfe4957",
            "image": "postgres:15.19",
            "image_created": "2026-08-25T00:44:24.286779757Z",
            "image_ref": "postgres@sha256:9b1d34adbce1dd07ee6e94b4a2cf698884b89bd44a6c9c12f5da8f3acbfe4957",
            "log_destination": "csvlog,jsonlog",
            "os": "linux",
            "repo_digests": [
              "postgres@sha256:9b1d34adbce1dd07ee6e94b4a2cf698884b89bd44a6c9c12f5da8f3acbfe4957"
            ]
          },
          "lc_messages": "en_US.utf8",
          "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": "15.19 (Debian 15.19-1.pgdg13+2)",
          "server_version_num": "150019",
          "target_kind": "docker-version",
          "wal_level": "logical"
        },
        "cases": [
          {
            "assertions": [
              {
                "expected": 2,
                "name": "ordinary UNIQUE accepts two NULLs",
                "observed": 2,
                "passed": true
              },
              {
                "expected": "23505",
                "name": "PG15 explicit second NULL raises 23505",
                "observed": "23505",
                "passed": true
              },
              {
                "expected": "nulls_not_distinct_uq",
                "name": "explicit constraint is identified",
                "observed": "nulls_not_distinct_uq",
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "explicit duplicate leaves autocommit connection usable",
                "observed": "IDLE",
                "passed": true
              },
              {
                "expected": 2,
                "name": "valid repair commits after the duplicate",
                "observed": 2,
                "passed": true
              }
            ],
            "case_id": "nulls_not_distinct_version_boundary",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.033,
            "observed": {
              "explicit_duplicate": {
                "column_name": null,
                "constraint_name": "nulls_not_distinct_uq",
                "context": null,
                "datatype_name": null,
                "exception_type": "UniqueViolation",
                "internal_position": null,
                "internal_query": null,
                "message_detail": "Key (external_id)=(null) already exists.",
                "message_hint": null,
                "message_primary": "duplicate key value violates unique constraint \"nulls_not_distinct_uq\"",
                "schema_name": "c23505_nulls_not_distinct_version_boundary",
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "nbtinsert.c",
                "source_function": "_bt_check_unique",
                "source_line": "664",
                "sqlstate": "23505",
                "statement_position": null,
                "table_name": "explicit_nulls",
                "text": "duplicate key value violates unique constraint \"nulls_not_distinct_uq\"\nDETAIL:  Key (external_id)=(null) already exists."
              },
              "explicit_feature": "supported",
              "natural_23505_observed": true,
              "ordinary_unique": {
                "null_count": 2
              },
              "repaired_row_count": 2,
              "status_after_duplicate": "IDLE"
            },
            "schema": "c23505_nulls_not_distinct_version_boundary",
            "status": "passed"
          }
        ]
      }
    }
  ]
}
