{
  "schema": 1,
  "sqlstate": "39P03",
  "condition_name": "event_trigger_protocol_violated",
  "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#L313",
      "lines": "313"
    },
    {
      "id": "src.calls.REL_18_6",
      "kind": "local_artifact",
      "source_role": "source_call_scan",
      "sha256": "9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf"
    },
    {
      "id": "src.path.event-trigger",
      "kind": "upstream_source",
      "source_role": "resolved_report_context",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/commands/event_trigger.c",
      "sha256": "0c9d6c5da18411f63110aea40635cd82d8e1d591db5931ff37f3a52f53ee69eb",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/commands/event_trigger.c#L1542-L1545",
      "lines": "1542-1545,1635-1638,1656-1659,2072-2075"
    }
  ],
  "claims": [
    {
      "id": "identity",
      "statement": "39P03 is event_trigger_protocol_violated in Class 39.",
      "sources": [
        "src.errcodes.18.6"
      ],
      "method": "Read the fixed definition row."
    },
    {
      "id": "event-context",
      "statement": "The core event-trigger functions reject calls outside their required sql_drop, table_rewrite, or event-trigger context with this code.",
      "sources": [
        "src.path.event-trigger"
      ],
      "method": "Read each currentEventTriggerState guard and its message."
    },
    {
      "id": "function-boundary",
      "statement": "The message names the required event-trigger function context, so the failing boundary is call context rather than object existence alone.",
      "sources": [
        "src.path.event-trigger"
      ],
      "method": "Compare the guard with the function named in the message."
    }
  ],
  "messages": [
    {
      "id": "message.sql-drop",
      "sqlstate": "39P03",
      "primary_template": "%s can only be called in a sql_drop event trigger function",
      "severity_source": "ERROR",
      "sources": [
        "src.path.event-trigger"
      ]
    },
    {
      "id": "message.table-rewrite",
      "sqlstate": "39P03",
      "primary_template": "%s can only be called in a table_rewrite event trigger function",
      "severity_source": "ERROR",
      "sources": [
        "src.path.event-trigger"
      ]
    },
    {
      "id": "message.event-trigger",
      "sqlstate": "39P03",
      "primary_template": "%s can only be called in an event trigger function",
      "severity_source": "ERROR",
      "sources": [
        "src.path.event-trigger"
      ]
    }
  ],
  "usage_evidence": [
    {
      "scope": "definition",
      "status": "definition_only",
      "evidence_ids": [
        "identity"
      ]
    },
    {
      "scope": "event-trigger-path",
      "status": "source_path_confirmed",
      "evidence_ids": [
        "event-context"
      ]
    },
    {
      "scope": "natural-runtime",
      "status": "unknown",
      "evidence_ids": [
        "event-context"
      ]
    }
  ],
  "runtime": []
}
