{
  "schema": 1,
  "sqlstate": "42P19",
  "condition_name": "invalid_recursion",
  "sources": [
    {
      "id": "src.errcodes.42P19.18.6",
      "kind": "upstream_source",
      "source_role": "condition_definition",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/utils/errcodes.txt",
      "location": "line 345",
      "sha256": "6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt#L345"
    },
    {
      "id": "src.call.42P19.e59c077eba1a4a52a69a6d97",
      "kind": "upstream_source",
      "source_role": "source_call",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/parser/parse_agg.c",
      "location": "lines 1329-1333",
      "sha256": "6e80a805fddbfc9c7e0f3047b348bf992a20c99f16ce7fee89c7067753027f72",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/parser/parse_agg.c#L1329-L1333"
    },
    {
      "id": "src.call.42P19.e6e0586856ee8989b006f7ae",
      "kind": "upstream_source",
      "source_role": "source_call",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/parser/parse_cte.c",
      "location": "lines 940-944",
      "sha256": "908eef14ac26654fe0b9c176ef50e56ba710b7fcd8e1239b944d7c2152fc2d6b",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/parser/parse_cte.c#L940-L944"
    },
    {
      "id": "src.call.42P19.3b25492c51b06d773f237993",
      "kind": "upstream_source",
      "source_role": "source_call",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/parser/parse_cte.c",
      "location": "lines 1072-1077",
      "sha256": "908eef14ac26654fe0b9c176ef50e56ba710b7fcd8e1239b944d7c2152fc2d6b",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/parser/parse_cte.c#L1072-L1077"
    },
    {
      "id": "src.call.42P19.recursion-context",
      "kind": "upstream_source",
      "source_role": "source_call",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/parser/parse_cte.c",
      "location": "lines 1056-1069",
      "sha256": "908eef14ac26654fe0b9c176ef50e56ba710b7fcd8e1239b944d7c2152fc2d6b",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/parser/parse_cte.c#L1056-L1069"
    },
    {
      "id": "src.calls.REL_18_6.42P19",
      "kind": "local_artifact",
      "source_role": "source_call_scan",
      "sha256": "9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf"
    }
  ],
  "claims": [
    {
      "id": "identity.class-and-condition",
      "statement": "42P19 is the invalid_recursion condition in Class 42.",
      "method": "Read fixed REL_18_6 errcodes.txt and locked facts.",
      "limits": "Identity does not enumerate all source branches or client failures.",
      "sources": [
        "src.errcodes.42P19.18.6"
      ]
    },
    {
      "id": "mechanism.selected-source-path",
      "statement": "Core 18.6 checks aggregate use in the recursive term, the required non-recursive UNION [ALL] recursive form, and recursive-reference context and multiplicity. The selected aggregate guard is p_hasAggs; it does not establish that every window function is forbidden. Outer-join context applies to the nullable side (LEFT right, RIGHT left, FULL both), while the preserved side of a one-sided join is not covered by that guard.",
      "method": "Read selected resolved REL_18_6 report groups and message roles.",
      "limits": "Representative confirmed core paths only; not exhaustive historical or extension coverage.",
      "sources": [
        "src.call.42P19.e59c077eba1a4a52a69a6d97",
        "src.call.42P19.e6e0586856ee8989b006f7ae",
        "src.call.42P19.3b25492c51b06d773f237993",
        "src.call.42P19.recursion-context"
      ]
    },
    {
      "id": "versions.catalogue-boundary",
      "statement": "Locked catalogue snapshots show this condition by PostgreSQL 8.4.0; source behavior here is fixed at PostgreSQL 18.6.",
      "method": "Read locked catalogue facts and definition snapshot.",
      "limits": "First observed release is a lower bound, not precise behavioral introduction.",
      "sources": [
        "src.errcodes.42P19.18.6"
      ]
    }
  ],
  "messages": [
    {
      "id": "message.variant-1",
      "sqlstate": "42P19",
      "severity_source": "ERROR",
      "primary_template": "aggregate functions are not allowed in a recursive query's recursive term",
      "detail_templates": [],
      "hint_templates": [],
      "roles": [
        {
          "role": "errmsg",
          "template": "aggregate functions are not allowed in a recursive query's recursive term"
        }
      ],
      "sources": [
        "src.call.42P19.e59c077eba1a4a52a69a6d97"
      ],
      "limits": "Placeholders remain dynamic source fields; no concrete runtime value is claimed."
    },
    {
      "id": "message.variant-2",
      "sqlstate": "42P19",
      "severity_source": "ERROR",
      "primary_template": "recursive query \"%s\" does not have the form non-recursive-term UNION [ALL] recursive-term",
      "detail_templates": [],
      "hint_templates": [],
      "roles": [
        {
          "role": "errmsg",
          "template": "recursive query \"%s\" does not have the form non-recursive-term UNION [ALL] recursive-term"
        }
      ],
      "sources": [
        "src.call.42P19.e6e0586856ee8989b006f7ae"
      ],
      "limits": "Placeholders remain dynamic source fields; no concrete runtime value is claimed."
    },
    {
      "id": "message.variant-3",
      "sqlstate": "42P19",
      "severity_source": "ERROR",
      "primary_template": "recursive reference to query \"%s\" must not appear more than once",
      "detail_templates": [],
      "hint_templates": [],
      "roles": [
        {
          "role": "errmsg",
          "template": "recursive reference to query \"%s\" must not appear more than once"
        }
      ],
      "sources": [
        "src.call.42P19.3b25492c51b06d773f237993"
      ],
      "limits": "Placeholders remain dynamic source fields; no concrete runtime value is claimed."
    }
  ],
  "usage_evidence": [
    {
      "scope": "SQLSTATE definition and release identity",
      "status": "definition_only",
      "evidence_ids": [
        "identity.class-and-condition",
        "src.errcodes.42P19.18.6"
      ]
    },
    {
      "scope": "Selected PostgreSQL 18.6 source emitters and message roles",
      "status": "source_path_confirmed",
      "evidence_ids": [
        "mechanism.selected-source-path"
      ]
    },
    {
      "scope": "Natural runtime execution for this batch",
      "status": "unknown",
      "evidence_ids": []
    }
  ],
  "runtime": []
}
