{
  "schema": 1,
  "sqlstate": "22012",
  "condition_name": "division_by_zero",
  "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#L182",
      "lines": "182"
    },
    {
      "id": "src.numeric-div.18.6",
      "kind": "upstream_source",
      "source_role": "resolved_report_context",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/utils/adt/numeric.c",
      "sha256": "6cde7cd60b3330b83be35d1f014045f5fb5fe737f3c5db4c8ed4080b99f2b666",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/numeric.c#L3243-3375",
      "lines": "3243-3375"
    },
    {
      "id": "src.numeric-mod.18.6",
      "kind": "upstream_source",
      "source_role": "resolved_report_context",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/utils/adt/numeric.c",
      "sha256": "6cde7cd60b3330b83be35d1f014045f5fb5fe737f3c5db4c8ed4080b99f2b666",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/numeric.c#L3467-3553",
      "lines": "3467-3553"
    },
    {
      "id": "src.int-div.18.6",
      "kind": "upstream_source",
      "source_role": "resolved_report_context",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/utils/adt/int.c",
      "sha256": "ed5a4718016a9acaf68eb08d97bb5c8973c450444dca57e0b953d11c99695e77",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/int.c#L861-875",
      "lines": "861-875"
    },
    {
      "id": "src.int-mod.18.6",
      "kind": "upstream_source",
      "source_role": "resolved_report_context",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/utils/adt/int.c",
      "sha256": "ed5a4718016a9acaf68eb08d97bb5c8973c450444dca57e0b953d11c99695e77",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/int.c#L1158-1184",
      "lines": "1158-1184"
    },
    {
      "id": "src.int8-div.18.6",
      "kind": "upstream_source",
      "source_role": "resolved_report_context",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/utils/adt/int8.c",
      "sha256": "da4d3688c0b037346f25419ea31020af9fec54021f182370234dcbf70b748f36",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/int8.c#L503-517",
      "lines": "503-517"
    },
    {
      "id": "src.int8-mod.18.6",
      "kind": "upstream_source",
      "source_role": "resolved_report_context",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/utils/adt/int8.c",
      "sha256": "da4d3688c0b037346f25419ea31020af9fec54021f182370234dcbf70b748f36",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/int8.c#L559-588",
      "lines": "559-588"
    },
    {
      "id": "src.float-inline.18.6",
      "kind": "upstream_source",
      "source_role": "resolved_report_context",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/include/utils/float.h",
      "sha256": "e41d97d3eff1ee8447f56562cdf649733330b56f07ee3d81325ee096ff5fd446",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/include/utils/float.h#L222-250",
      "lines": "222-250"
    },
    {
      "id": "src.float-error.18.6",
      "kind": "upstream_source",
      "source_role": "resolved_report_context",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/utils/adt/float.c",
      "sha256": "58914ae93c06c281e581a4bb2dcf2280e4ae1619f3ceb8f801f50beca87eecd8",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/float.c#L101-106",
      "lines": "101-106"
    },
    {
      "id": "src.cash-int.18.6",
      "kind": "upstream_source",
      "source_role": "resolved_report_context",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/utils/adt/cash.c",
      "sha256": "a6b9d7af9e8d697b737a5ed5ae98226ed317ec75c06f3fb2dcb057a6bd6a92b3",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/cash.c#L155-161",
      "lines": "155-161"
    },
    {
      "id": "src.cash-money.18.6",
      "kind": "upstream_source",
      "source_role": "resolved_report_context",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/utils/adt/cash.c",
      "sha256": "a6b9d7af9e8d697b737a5ed5ae98226ed317ec75c06f3fb2dcb057a6bd6a92b3",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/cash.c#L728-744",
      "lines": "728-744"
    },
    {
      "id": "src.interval-div.18.6",
      "kind": "upstream_source",
      "source_role": "resolved_report_context",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/utils/adt/timestamp.c",
      "sha256": "2614ccd2182fa904b4cac9bef43039e90a1af578d2d1c6803d49a07420d168f2",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/timestamp.c#L3759-3776",
      "lines": "3759-3776"
    },
    {
      "id": "src.planner-const.18.6",
      "kind": "upstream_source",
      "source_role": "planner_context",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/optimizer/util/clauses.c",
      "sha256": "7268380af5eccec9e3bf90179f0a2753a7f50426d62af143a451b7f0fb542732",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/optimizer/util/clauses.c#L2437-2462",
      "lines": "2437-2462"
    },
    {
      "id": "src.docs-conditional.18.6",
      "kind": "upstream_source",
      "source_role": "conditional_expression_documentation",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "doc/src/sgml/func.sgml",
      "sha256": "05d03f505dc3c3b4fb2b3a6e8ed3275c425306a8ff20dd9548e838c26bbb968a",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/func.sgml#L20143-20150",
      "lines": "20143-20150"
    },
    {
      "id": "snippet-registry.22012",
      "kind": "local_artifact",
      "source_role": "runtime_input",
      "sha256": "d070ef39a492c0411c3fc2cf9cc841321cae85cbd8a2f8d169f49ecbadbd3be7"
    }
  ],
  "claims": [
    {
      "id": "identity",
      "statement": "22012 is division_by_zero in SQLSTATE Class 22.",
      "sources": [
        "src.errcodes.18.6"
      ],
      "method": "Read the fixed errcodes row and macro."
    },
    {
      "id": "numeric-divmod",
      "statement": "Numeric division and modulo guard zero divisors; direct SQL calls raise, while internal opt-error forms can report through a have_error soft path.",
      "sources": [
        "src.numeric-div.18.6",
        "src.numeric-mod.18.6"
      ],
      "method": "Read the complete numeric division and modulo functions."
    },
    {
      "id": "integer-divmod",
      "statement": "The int4 and int8 division and modulo functions check their second operand before using the arithmetic operator.",
      "sources": [
        "src.int-div.18.6",
        "src.int-mod.18.6",
        "src.int8-div.18.6",
        "src.int8-mod.18.6"
      ],
      "method": "Read the representative integer and bigint guards."
    },
    {
      "id": "float-guard",
      "statement": "float4/float8 division raises for a zero divisor only when the numerator is not NaN, through the inline zero-divide helper.",
      "sources": [
        "src.float-inline.18.6",
        "src.float-error.18.6"
      ],
      "method": "Read the exact val2==0 and !isnan(val1) guard."
    },
    {
      "id": "money-and-interval",
      "statement": "Money division checks its divisor and interval division rejects a zero factor with the same condition.",
      "sources": [
        "src.cash-int.18.6",
        "src.cash-money.18.6",
        "src.interval-div.18.6"
      ],
      "method": "Read the type-specific division guards."
    },
    {
      "id": "planner-boundary",
      "statement": "The planner can evaluate an immutable constant division while simplifying expressions; same-tag conditional-expression documentation calls out unreachable CASE 1/0 as a planning-time failure boundary.",
      "sources": [
        "src.planner-const.18.6",
        "src.docs-conditional.18.6"
      ],
      "method": "Read the planner evaluation path and same-tag documentation.",
      "limits": "This is a planning/execution boundary, not an assertion that every CASE expression is evaluated early."
    },
    {
      "id": "runtime.observation",
      "statement": "The retained numeric division case observed 22012 for 10::numeric / 0::numeric and 5.0000000000000000 after 10::numeric / 2::numeric on PostgreSQL 18.6 and 10.21; both repaired sessions were IDLE.",
      "sources": [
        "runtime.22012-data-runtime-latest.latest",
        "runtime.22012-data-runtime-pg10.pg10",
        "snippet-registry.22012"
      ],
      "method": "Read both retained summaries, raw digests, and the fixed snippet registry.",
      "limits": "The observation covers this numeric case and does not generalize to every producer."
    },
    {
      "id": "history",
      "statement": "The locked catalogue records 22012 from 7.4 without proving an exact implementation introduction date.",
      "sources": [
        "src.errcodes.18.6"
      ],
      "method": "Use catalogue presence and history boundaries."
    }
  ],
  "messages": [
    {
      "id": "message.division-by-zero",
      "sqlstate": "22012",
      "primary_template": "division by zero",
      "severity_source": "ERROR",
      "sources": [
        "src.numeric-div.18.6",
        "src.numeric-mod.18.6",
        "src.int-div.18.6",
        "src.int-mod.18.6",
        "src.int8-div.18.6",
        "src.int8-mod.18.6",
        "src.float-inline.18.6",
        "src.float-error.18.6",
        "src.cash-int.18.6",
        "src.cash-money.18.6",
        "src.interval-div.18.6"
      ],
      "limits": "Direct cited guards; special values and internal numeric soft callers are type/context dependent."
    }
  ],
  "usage_evidence": [
    {
      "scope": "definition",
      "status": "definition_only",
      "evidence_ids": [
        "identity"
      ]
    },
    {
      "scope": "fixed-source-path",
      "status": "source_path_confirmed",
      "evidence_ids": [
        "numeric-divmod",
        "integer-divmod",
        "float-guard",
        "money-and-interval",
        "planner-boundary"
      ]
    },
    {
      "scope": "history",
      "status": "unknown",
      "evidence_ids": [
        "history"
      ]
    },
    {
      "scope": "natural-runtime",
      "status": "observed_runtime",
      "evidence_ids": [
        "runtime.observation",
        "runtime.22012-data-runtime-latest.latest",
        "runtime.22012-data-runtime-pg10.pg10"
      ]
    }
  ],
  "runtime": [
    {
      "id": "runtime.22012-data-runtime-latest.latest",
      "run_id": "22012-data-runtime-latest",
      "target": "latest",
      "server_version": "18.6 (Homebrew)",
      "server_version_num": 180006,
      "status": "passed",
      "cases": [
        "division_by_zero_numeric"
      ],
      "summary_sha256": "a92ed17a37d32b0a6dc3f30c2b900f4d643fa0dea2736110b1d6170ccba4157c",
      "raw_sha256": "9d7035f924444adf1fa68308787310083c584343376d7b041e803a3bd2e1b539",
      "snippet_registry": {
        "sha256": "d070ef39a492c0411c3fc2cf9cc841321cae85cbd8a2f8d169f49ecbadbd3be7"
      },
      "observed": {
        "sqlstate": "22012",
        "status_after_repair": "IDLE"
      }
    },
    {
      "id": "runtime.22012-data-runtime-pg10.pg10",
      "run_id": "22012-data-runtime-pg10",
      "target": "pg10",
      "server_version": "10.21 (Debian 10.21-1.pgdg90+1)",
      "server_version_num": 100021,
      "status": "passed",
      "cases": [
        "division_by_zero_numeric"
      ],
      "summary_sha256": "60991b51352ba0c2294f65719ada02e39aba969e7467755b138febedcd548e50",
      "raw_sha256": "e8b465904879a89b453d291d4cabddcfe8920ea8c9752f83213644e84f6510f2",
      "snippet_registry": {
        "sha256": "d070ef39a492c0411c3fc2cf9cc841321cae85cbd8a2f8d169f49ecbadbd3be7"
      },
      "observed": {
        "sqlstate": "22012",
        "status_after_repair": "IDLE"
      }
    }
  ]
}
