{
  "schema_version": 1,
  "generated_at": "2026-10-20T22:30:07.049172+00:00",
  "experiment": "postgresql-toast-coverage",
  "harness_sha256": "d4aa5f39f8b4a995e170557eb5555a1175c75409fe8d36c17497a96db4e26b98",
  "evidence_type": "Actual PostgreSQL on synthetic data with one deliberate offline bit flip",
  "environment": {
    "python": "3.12.3",
    "system": "Linux",
    "kernel": "6.8.0-146-generic",
    "architecture": "x86_64",
    "postgres": "postgres (PostgreSQL) 16.15 (Ubuntu 16.15-0ubuntu0.24.04.1)",
    "psql": "psql (PostgreSQL) 16.15 (Ubuntu 16.15-0ubuntu0.24.04.1)",
    "pg_amcheck": "pg_amcheck (PostgreSQL) 16.15 (Ubuntu 16.15-0ubuntu0.24.04.1)",
    "postgres_sha256": "201d8daff9a5bd9df70b820471b965c39f5a776d677f395232c477d051270722"
  },
  "fixture": {
    "rows": 1,
    "payload_bytes": 24045,
    "storage": "EXTERNAL",
    "expected_sha256": "28bd9067b827f8989cbf6a302fc0f6d9e35af84f87a3d694a39bba28ad6de4a7",
    "prefix_bytes": 32,
    "marker": "HESELA_TOAST_TAIL_0123456789_abcdefghijklmnop",
    "synthetic": true
  },
  "cases": [
    {
      "checksums": true,
      "settings": {
        "version": "PostgreSQL 16.15 (Ubuntu 16.15-0ubuntu0.24.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0, 64-bit",
        "checksums": "on",
        "block_size": "8192",
        "server_encoding": "UTF8",
        "ignore_checksum_failure": "off"
      },
      "toast_chunks": 13,
      "mutation": {
        "relation": "base/5/16394",
        "byte_offset": 32716,
        "block": 3,
        "byte_within_block": 8140,
        "before": 72,
        "after": 73,
        "xor_mask": 1,
        "changed_bytes": 1,
        "relation_bytes": 32768,
        "sha256_before": "f00fe81185fcc787b0ebb518e7a75a0bae09e1841c676bc1b0f00bd2f3213746",
        "sha256_after": "1c9069eb266441570e99223cf5de5b9ccb0b5ef9962d0c20e987c7917275e028",
        "checksum_recomputed": false
      },
      "clean": {
        "probes": {
          "row_count": {
            "sql": "SELECT count(*) FROM public.payloads;",
            "returncode": 0,
            "stdout": "1",
            "stderr": ""
          },
          "byte_length": {
            "sql": "SELECT octet_length(body) FROM public.payloads;",
            "returncode": 0,
            "stdout": "24045",
            "stderr": ""
          },
          "prefix": {
            "sql": "SELECT encode(substring(body FROM 1 FOR 32), 'hex') FROM public.payloads;",
            "returncode": 0,
            "stdout": "4141414141414141414141414141414141414141414141414141414141414141",
            "stderr": ""
          },
          "whole_sha256": {
            "sql": "SELECT encode(sha256(body), 'hex') FROM public.payloads;",
            "returncode": 0,
            "stdout": "28bd9067b827f8989cbf6a302fc0f6d9e35af84f87a3d694a39bba28ad6de4a7",
            "stderr": ""
          },
          "heap_without_toast": {
            "sql": "SELECT coalesce(json_agg(v), '[]') FROM verify_heapam('public.payloads', false, false, 'none') v;",
            "returncode": 0,
            "stdout": "[]",
            "stderr": ""
          },
          "heap_with_toast": {
            "sql": "SELECT coalesce(json_agg(v), '[]') FROM verify_heapam('public.payloads', false, true, 'none') v;",
            "returncode": 0,
            "stdout": "[]",
            "stderr": ""
          },
          "amcheck_default": {
            "options": [
              "--table=public.payloads",
              "--no-dependent-indexes"
            ],
            "returncode": 0,
            "stdout": "",
            "stderr": ""
          },
          "amcheck_no_pointers": {
            "options": [
              "--table=public.payloads",
              "--no-dependent-indexes",
              "--exclude-toast-pointers"
            ],
            "returncode": 0,
            "stdout": "",
            "stderr": ""
          },
          "amcheck_no_dependent_toast": {
            "options": [
              "--table=public.payloads",
              "--no-dependent-indexes",
              "--no-dependent-toast"
            ],
            "returncode": 0,
            "stdout": "",
            "stderr": ""
          },
          "amcheck_neither": {
            "options": [
              "--table=public.payloads",
              "--no-dependent-indexes",
              "--exclude-toast-pointers",
              "--no-dependent-toast"
            ],
            "returncode": 0,
            "stdout": "",
            "stderr": ""
          }
        },
        "offline_checksums": {
          "returncode": 0,
          "stdout": "Checksum operation completed\nFiles scanned:   956\nBlocks scanned:  2837\nBad checksums:  0\nData checksum version: 1",
          "stderr": ""
        }
      },
      "damaged": {
        "probes": {
          "row_count": {
            "sql": "SELECT count(*) FROM public.payloads;",
            "returncode": 0,
            "stdout": "1",
            "stderr": ""
          },
          "byte_length": {
            "sql": "SELECT octet_length(body) FROM public.payloads;",
            "returncode": 0,
            "stdout": "24045",
            "stderr": ""
          },
          "prefix": {
            "sql": "SELECT encode(substring(body FROM 1 FOR 32), 'hex') FROM public.payloads;",
            "returncode": 0,
            "stdout": "4141414141414141414141414141414141414141414141414141414141414141",
            "stderr": ""
          },
          "whole_sha256": {
            "sql": "SELECT encode(sha256(body), 'hex') FROM public.payloads;",
            "returncode": 1,
            "stdout": "",
            "stderr": "WARNING:  page verification failed, calculated checksum 41685 but expected 2965\nERROR:  invalid page in block 3 of relation base/5/16394"
          },
          "heap_without_toast": {
            "sql": "SELECT coalesce(json_agg(v), '[]') FROM verify_heapam('public.payloads', false, false, 'none') v;",
            "returncode": 0,
            "stdout": "[]",
            "stderr": ""
          },
          "heap_with_toast": {
            "sql": "SELECT coalesce(json_agg(v), '[]') FROM verify_heapam('public.payloads', false, true, 'none') v;",
            "returncode": 1,
            "stdout": "",
            "stderr": "WARNING:  page verification failed, calculated checksum 41685 but expected 2965\nERROR:  invalid page in block 3 of relation base/5/16394"
          },
          "amcheck_default": {
            "options": [
              "--table=public.payloads",
              "--no-dependent-indexes"
            ],
            "returncode": 2,
            "stdout": "heap table \"postgres.pg_toast.pg_toast_16391\":\n    ERROR:  invalid page in block 3 of relation base/5/16394\nheap table \"postgres.public.payloads\":\n    ERROR:  invalid page in block 3 of relation base/5/16394",
            "stderr": "WARNING:  page verification failed, calculated checksum 41685 but expected 2965\nWARNING:  page verification failed, calculated checksum 41685 but expected 2965"
          },
          "amcheck_no_pointers": {
            "options": [
              "--table=public.payloads",
              "--no-dependent-indexes",
              "--exclude-toast-pointers"
            ],
            "returncode": 2,
            "stdout": "heap table \"postgres.pg_toast.pg_toast_16391\":\n    ERROR:  invalid page in block 3 of relation base/5/16394",
            "stderr": "WARNING:  page verification failed, calculated checksum 41685 but expected 2965"
          },
          "amcheck_no_dependent_toast": {
            "options": [
              "--table=public.payloads",
              "--no-dependent-indexes",
              "--no-dependent-toast"
            ],
            "returncode": 2,
            "stdout": "heap table \"postgres.public.payloads\":\n    ERROR:  invalid page in block 3 of relation base/5/16394",
            "stderr": "WARNING:  page verification failed, calculated checksum 41685 but expected 2965"
          },
          "amcheck_neither": {
            "options": [
              "--table=public.payloads",
              "--no-dependent-indexes",
              "--exclude-toast-pointers",
              "--no-dependent-toast"
            ],
            "returncode": 0,
            "stdout": "",
            "stderr": ""
          }
        },
        "offline_checksums": {
          "returncode": 1,
          "stdout": "Checksum operation completed\nFiles scanned:   956\nBlocks scanned:  2837\nBad checksums:  1\nData checksum version: 1",
          "stderr": "pg_checksums: error: checksum verification failed in file \"/srv/cgpt-workspace/tmp/ht-mrc88dms/data/base/5/16394\", block 3: calculated checksum A2D5 but block contains B95"
        }
      }
    },
    {
      "checksums": false,
      "settings": {
        "version": "PostgreSQL 16.15 (Ubuntu 16.15-0ubuntu0.24.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0, 64-bit",
        "checksums": "off",
        "block_size": "8192",
        "server_encoding": "UTF8",
        "ignore_checksum_failure": "off"
      },
      "toast_chunks": 13,
      "mutation": {
        "relation": "base/5/16394",
        "byte_offset": 32716,
        "block": 3,
        "byte_within_block": 8140,
        "before": 72,
        "after": 73,
        "xor_mask": 1,
        "changed_bytes": 1,
        "relation_bytes": 32768,
        "sha256_before": "075a98885d87214f131cc8424d586f30150568f8e6305c8e9b8c427c7f20d821",
        "sha256_after": "5367cc42d8a64a12c9ba2d60e7515aacefdf379227a99dcfd7262fbe1bc1e316",
        "checksum_recomputed": false
      },
      "clean": {
        "probes": {
          "row_count": {
            "sql": "SELECT count(*) FROM public.payloads;",
            "returncode": 0,
            "stdout": "1",
            "stderr": ""
          },
          "byte_length": {
            "sql": "SELECT octet_length(body) FROM public.payloads;",
            "returncode": 0,
            "stdout": "24045",
            "stderr": ""
          },
          "prefix": {
            "sql": "SELECT encode(substring(body FROM 1 FOR 32), 'hex') FROM public.payloads;",
            "returncode": 0,
            "stdout": "4141414141414141414141414141414141414141414141414141414141414141",
            "stderr": ""
          },
          "whole_sha256": {
            "sql": "SELECT encode(sha256(body), 'hex') FROM public.payloads;",
            "returncode": 0,
            "stdout": "28bd9067b827f8989cbf6a302fc0f6d9e35af84f87a3d694a39bba28ad6de4a7",
            "stderr": ""
          },
          "heap_without_toast": {
            "sql": "SELECT coalesce(json_agg(v), '[]') FROM verify_heapam('public.payloads', false, false, 'none') v;",
            "returncode": 0,
            "stdout": "[]",
            "stderr": ""
          },
          "heap_with_toast": {
            "sql": "SELECT coalesce(json_agg(v), '[]') FROM verify_heapam('public.payloads', false, true, 'none') v;",
            "returncode": 0,
            "stdout": "[]",
            "stderr": ""
          },
          "amcheck_default": {
            "options": [
              "--table=public.payloads",
              "--no-dependent-indexes"
            ],
            "returncode": 0,
            "stdout": "",
            "stderr": ""
          },
          "amcheck_no_pointers": {
            "options": [
              "--table=public.payloads",
              "--no-dependent-indexes",
              "--exclude-toast-pointers"
            ],
            "returncode": 0,
            "stdout": "",
            "stderr": ""
          },
          "amcheck_no_dependent_toast": {
            "options": [
              "--table=public.payloads",
              "--no-dependent-indexes",
              "--no-dependent-toast"
            ],
            "returncode": 0,
            "stdout": "",
            "stderr": ""
          },
          "amcheck_neither": {
            "options": [
              "--table=public.payloads",
              "--no-dependent-indexes",
              "--exclude-toast-pointers",
              "--no-dependent-toast"
            ],
            "returncode": 0,
            "stdout": "",
            "stderr": ""
          }
        },
        "offline_checksums": {
          "returncode": 1,
          "stdout": "",
          "stderr": "pg_checksums: error: data checksums are not enabled in cluster"
        }
      },
      "damaged": {
        "probes": {
          "row_count": {
            "sql": "SELECT count(*) FROM public.payloads;",
            "returncode": 0,
            "stdout": "1",
            "stderr": ""
          },
          "byte_length": {
            "sql": "SELECT octet_length(body) FROM public.payloads;",
            "returncode": 0,
            "stdout": "24045",
            "stderr": ""
          },
          "prefix": {
            "sql": "SELECT encode(substring(body FROM 1 FOR 32), 'hex') FROM public.payloads;",
            "returncode": 0,
            "stdout": "4141414141414141414141414141414141414141414141414141414141414141",
            "stderr": ""
          },
          "whole_sha256": {
            "sql": "SELECT encode(sha256(body), 'hex') FROM public.payloads;",
            "returncode": 0,
            "stdout": "9d9a6b2dfb3311e85b174b7a2e49f27bae402ad6ae1f171e7884fbc590687344",
            "stderr": ""
          },
          "heap_without_toast": {
            "sql": "SELECT coalesce(json_agg(v), '[]') FROM verify_heapam('public.payloads', false, false, 'none') v;",
            "returncode": 0,
            "stdout": "[]",
            "stderr": ""
          },
          "heap_with_toast": {
            "sql": "SELECT coalesce(json_agg(v), '[]') FROM verify_heapam('public.payloads', false, true, 'none') v;",
            "returncode": 0,
            "stdout": "[]",
            "stderr": ""
          },
          "amcheck_default": {
            "options": [
              "--table=public.payloads",
              "--no-dependent-indexes"
            ],
            "returncode": 0,
            "stdout": "",
            "stderr": ""
          },
          "amcheck_no_pointers": {
            "options": [
              "--table=public.payloads",
              "--no-dependent-indexes",
              "--exclude-toast-pointers"
            ],
            "returncode": 0,
            "stdout": "",
            "stderr": ""
          },
          "amcheck_no_dependent_toast": {
            "options": [
              "--table=public.payloads",
              "--no-dependent-indexes",
              "--no-dependent-toast"
            ],
            "returncode": 0,
            "stdout": "",
            "stderr": ""
          },
          "amcheck_neither": {
            "options": [
              "--table=public.payloads",
              "--no-dependent-indexes",
              "--exclude-toast-pointers",
              "--no-dependent-toast"
            ],
            "returncode": 0,
            "stdout": "",
            "stderr": ""
          }
        },
        "offline_checksums": {
          "returncode": 1,
          "stdout": "",
          "stderr": "pg_checksums: error: data checksums are not enabled in cluster"
        }
      }
    }
  ],
  "assertions_passed": true,
  "limits": [
    "Not a hardware-failure rate or exhaustive corruption campaign.",
    "Uncompressed bytea only; not compressed text, indexes, concurrency or recovery.",
    "Successful structural checking is not an expected-content comparison.",
    "Checksum settings differ across separately initialized clusters."
  ]
}
