{
  "schema": 1,
  "sqlstate": "42P13",
  "condition_name": "invalid_function_definition",
  "sources": [
    {
      "id": "src.errcodes.42P13.18.6",
      "kind": "upstream_source",
      "source_role": "condition_definition",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/utils/errcodes.txt",
      "location": "line 394",
      "sha256": "6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt#L394"
    },
    {
      "id": "src.call.42P13.59b4e33cdd3e899e2a030829",
      "kind": "upstream_source",
      "source_role": "source_call",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/catalog/pg_aggregate.c",
      "location": "lines 142-145",
      "sha256": "75c08cdd82917e45647f7c523c9ad8fb49423c89f13e26754be1e37e4c6a49b4",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/catalog/pg_aggregate.c#L142-L145"
    },
    {
      "id": "src.call.42P13.2ffff7c5778d60ac8f47ff67",
      "kind": "upstream_source",
      "source_role": "source_call",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/executor/functions.c",
      "location": "lines 2222-2226",
      "sha256": "ea37a18fab0f741445874b63e239027ff3901273a9d8e2046be321d3c021a604",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/executor/functions.c#L2222-L2226"
    },
    {
      "id": "src.call.42P13.1f3147b83dd1ece95cf5aaf0",
      "kind": "upstream_source",
      "source_role": "source_call",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/pl/plpgsql/src/pl_comp.c",
      "location": "lines 493-496",
      "sha256": "1da6339c6a538df3045d02326c96d9afe3447c68173ebee0aefee0bca3a2ae09",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/pl/plpgsql/src/pl_comp.c#L493-L496"
    },
    {
      "id": "src.calls.REL_18_6.42P13",
      "kind": "local_artifact",
      "source_role": "source_call_scan",
      "sha256": "9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf"
    }
  ],
  "claims": [
    {
      "id": "identity.class-and-condition",
      "statement": "42P13 is the invalid_function_definition 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.42P13.18.6"
      ]
    },
    {
      "id": "mechanism.selected-source-path",
      "statement": "Selected core paths cover a polymorphic aggregate transition type that cannot be determined with a caller-generated internal DETAIL, a function return-type mismatch when the final statement is not a compatible SELECT or DML RETURNING, and trigger functions declaring arguments.",
      "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.42P13.59b4e33cdd3e899e2a030829",
        "src.call.42P13.2ffff7c5778d60ac8f47ff67",
        "src.call.42P13.1f3147b83dd1ece95cf5aaf0"
      ]
    },
    {
      "id": "versions.catalogue-boundary",
      "statement": "Locked catalogue snapshots show this condition by PostgreSQL 7.4; 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.42P13.18.6"
      ]
    }
  ],
  "messages": [
    {
      "id": "message.variant-1",
      "sqlstate": "42P13",
      "severity_source": "ERROR",
      "primary_template": "cannot determine transition data type",
      "detail_templates": [
        "%s"
      ],
      "hint_templates": [],
      "roles": [
        {
          "role": "errmsg",
          "template": "cannot determine transition data type"
        },
        {
          "role": "errdetail_internal",
          "template": "%s"
        }
      ],
      "sources": [
        "src.call.42P13.59b4e33cdd3e899e2a030829"
      ],
      "limits": "Placeholders remain dynamic source fields; no concrete runtime value is claimed."
    },
    {
      "id": "message.variant-2",
      "sqlstate": "42P13",
      "severity_source": "ERROR",
      "primary_template": "return type mismatch in function declared to return %s",
      "detail_templates": [
        "Function's final statement must be SELECT or INSERT/UPDATE/DELETE/MERGE RETURNING."
      ],
      "hint_templates": [],
      "roles": [
        {
          "role": "errmsg",
          "template": "return type mismatch in function declared to return %s"
        },
        {
          "role": "errdetail",
          "template": "Function's final statement must be SELECT or INSERT/UPDATE/DELETE/MERGE RETURNING."
        }
      ],
      "sources": [
        "src.call.42P13.2ffff7c5778d60ac8f47ff67"
      ],
      "limits": "Placeholders remain dynamic source fields; no concrete runtime value is claimed."
    },
    {
      "id": "message.variant-3",
      "sqlstate": "42P13",
      "severity_source": "ERROR",
      "primary_template": "trigger functions cannot have declared arguments",
      "detail_templates": [],
      "hint_templates": [
        "The arguments of the trigger can be accessed through TG_NARGS and TG_ARGV instead."
      ],
      "roles": [
        {
          "role": "errmsg",
          "template": "trigger functions cannot have declared arguments"
        },
        {
          "role": "errhint",
          "template": "The arguments of the trigger can be accessed through TG_NARGS and TG_ARGV instead."
        }
      ],
      "sources": [
        "src.call.42P13.1f3147b83dd1ece95cf5aaf0"
      ],
      "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.42P13.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": []
}
