{
  "schema": 1,
  "sqlstate": "23502",
  "condition_name": "not_null_violation",
  "sources": [
    {
      "id": "src.errcodes.18.6",
      "kind": "upstream_source",
      "source_role": "condition_definition",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/utils/errcodes.txt",
      "sha256": "6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt"
    },
    {
      "id": "src.calls.REL_18_6",
      "kind": "local_artifact",
      "source_role": "source_call_scan",
      "sha256": "9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf"
    },
    {
      "id": "src.execMain.18.6",
      "kind": "upstream_source",
      "source_role": "source_path",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/executor/execMain.c",
      "sha256": "33b97337fa23a649c5e7a092e1bd405a54e8503529236c62c9d5bb93a1774a8d",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/executor/execMain.c#L2213-L2219"
    },
    {
      "id": "src.tablecmds.18.6",
      "kind": "upstream_source",
      "source_role": "source_path",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/commands/tablecmds.c",
      "sha256": "422dc8e833df4940755973c757e338295822ba3e4c7266c40669f49f96eb15a9",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/commands/tablecmds.c#L6465-L6490"
    },
    {
      "id": "doc.ddl-constraints.18.6",
      "kind": "upstream_source",
      "source_role": "official_documentation",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "doc/src/sgml/ddl.sgml",
      "sha256": "ce1919d9236f2e71672660e1a347146472e966e4d19b77fde5ae345dd1db6ec7",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/ddl.sgml",
      "docs_url": "https://www.postgresql.org/docs/18/ddl-constraints.html"
    },
    {
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "id": "src.typecmds.18.6",
      "kind": "upstream_source",
      "path": "src/backend/commands/typecmds.c",
      "sha256": "60d1e9754646e100f6b74aa367ad8c2c52386c400df721707423d329209c47eb",
      "source_role": "source_path",
      "tag": "REL_18_6",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/commands/typecmds.c#L3199-L3204"
    }
  ],
  "claims": [
    {
      "id": "identity",
      "statement": "23502 is not_null_violation in Class 23.",
      "sources": [
        "src.errcodes.18.6"
      ],
      "method": "Read the fixed errcodes row.",
      "limits": "The code says that a NOT NULL rule failed; it does not by itself distinguish DML from schema validation."
    },
    {
      "id": "dml-path",
      "statement": "The executor reports 23502 when a tuple has a NULL value for a NOT NULL column, with column/relation fields and an optional failing-row DETAIL.",
      "sources": [
        "src.execMain.18.6",
        "src.calls.REL_18_6"
      ],
      "method": "Trace ReportNotNullViolationError and its errtablecol metadata.",
      "limits": "The DETAIL can be omitted or vary with row-description settings; use structured column/table diagnostics."
    },
    {
      "id": "schema-path",
      "statement": "ALTER TABLE validation and domain NOT NULL validation use separate 23502 source templates; domain CHECK validation is a 23514 path.",
      "sources": [
        "src.tablecmds.18.6",
        "src.calls.REL_18_6",
        "src.typecmds.18.6"
      ],
      "method": "Compare the tablecmds and executor report groups.",
      "limits": "A repair must satisfy the actual schema rule; adding a default or relaxing NOT NULL is a migration decision, not a generic retry."
    },
    {
      "id": "runtime",
      "statement": "The selected insert case returned 23502 on PG18.6 and PG10.21, identified label/items, stayed IDLE in autocommit mode, and then inserted a valid row.",
      "sources": [
        "runtime.23502-batch1-latest-20260909.latest",
        "runtime.23502-batch1-pg10-20260909.pg10"
      ],
      "method": "Read the selected summaries and raw diagnostics.",
      "limits": "The case covers one INSERT path and not ALTER TABLE, domains, partitions, or trigger-generated NULLs."
    }
  ],
  "messages": [
    {
      "id": "insert",
      "sqlstate": "23502",
      "primary_template": "null value in column \"%s\" of relation \"%s\" violates not-null constraint",
      "severity_source": "ERROR",
      "sources": [
        "src.execMain.18.6"
      ],
      "limits": "The %s substitutions are the column, relation, and optional row description.",
      "detail_template": "Failing row contains %s."
    },
    {
      "id": "schema-not-null-validation",
      "limits": "This validation template reports existing rows while a relation schema is being validated.",
      "primary_template": "column \"%s\" of relation \"%s\" contains null values",
      "severity_source": "ERROR",
      "sources": [
        "src.tablecmds.18.6"
      ],
      "sqlstate": "23502"
    },
    {
      "id": "domain-not-null-validation",
      "limits": "This template is used while validating a domain NOT NULL rule against columns that use the domain.",
      "primary_template": "column \"%s\" of table \"%s\" contains null values",
      "severity_source": "ERROR",
      "sources": [
        "src.typecmds.18.6"
      ],
      "sqlstate": "23502"
    }
  ],
  "usage_evidence": [
    {
      "scope": "dml-runtime",
      "status": "observed_runtime",
      "evidence_ids": [
        "runtime",
        "runtime.23502-batch1-latest-20260909.latest",
        "runtime.23502-batch1-pg10-20260909.pg10"
      ]
    },
    {
      "scope": "source-paths",
      "status": "source_path_confirmed",
      "evidence_ids": [
        "identity",
        "dml-path",
        "schema-path"
      ]
    }
  ],
  "runtime": [
    {
      "id": "runtime.23502-batch1-latest-20260909.latest",
      "run_id": "23502-batch1-latest-20260909",
      "target": "latest",
      "server_version": "18.6 (Homebrew)",
      "server_version_num": 180006,
      "status": "passed",
      "cases": [
        "not_null_insert"
      ],
      "summary_sha256": "a224ad3252f2d40d8f1685a490fe4efe6cd8deb95515b5533c9002323387576a",
      "raw_sha256": "52cde4d2906d14030040c5034ac22d1331109e60ddc32bc7331ab11666986787",
      "snippet_registry": {
        "sha256": "f701e32a0e9214d6c88deabcda99981c288cae0f176d1dcaf383863c3942f8e0"
      },
      "case_manifest": {
        "sha256": "2a097af0bb10072da2300cf9a5626d13027ed5773bad917fd333b489f4b4f109"
      },
      "observed": {
        "sqlstate": "23502",
        "primary": "null value in column \"label\" of relation \"items\" violates not-null constraint",
        "detail": "Failing row contains (2, null).",
        "column": "label",
        "table": "items",
        "status_after_error": "IDLE",
        "rows": [
          [
            1,
            "seed"
          ],
          [
            2,
            "valid"
          ]
        ]
      }
    },
    {
      "id": "runtime.23502-batch1-pg10-20260909.pg10",
      "run_id": "23502-batch1-pg10-20260909",
      "target": "pg10",
      "server_version": "10.21 (Debian 10.21-1.pgdg90+1)",
      "server_version_num": 100021,
      "status": "passed",
      "cases": [
        "not_null_insert"
      ],
      "summary_sha256": "1449b9682de2708ea83657d8356bf28b716f5a6f27c52f26e12b2eb9e63a6bbc",
      "raw_sha256": "c1c8501748a78a9e9553ff3c7887b9f60c7a78973efefc6cc952374ec19f007c",
      "snippet_registry": {
        "sha256": "f701e32a0e9214d6c88deabcda99981c288cae0f176d1dcaf383863c3942f8e0"
      },
      "case_manifest": {
        "sha256": "2a097af0bb10072da2300cf9a5626d13027ed5773bad917fd333b489f4b4f109"
      },
      "observed": {
        "sqlstate": "23502",
        "primary": "null value in column \"label\" violates not-null constraint",
        "detail": "Failing row contains (2, null).",
        "column": "label",
        "table": "items",
        "status_after_error": "IDLE",
        "rows": [
          [
            1,
            "seed"
          ],
          [
            2,
            "valid"
          ]
        ]
      }
    }
  ]
}
