39P03 — event_trigger_protocol_violated
39P03 is eventtriggerprotocolviolated. Fixed event-trigger helpers reject calls outside their required sqldrop, table_rewrite, or event-trigger function context.
English manual coverage begins with PostgreSQL 8.1. Source history and runtime observations have their own recorded version boundaries.
Reading PG 18·Select a recorded version
- aliases
- Unknown
- class name
- External Routine Invocation Exception
- condition name
- event_trigger_protocol_violated
- lang
- en
- sqlstate
- 39P03
Definition PG 18
39P03
At a glance {#at-a-glance}
39P03 is event_trigger_protocol_violated. Fixed event-trigger helpers reject calls outside their required sql_drop, table_rewrite, or event-trigger function context.
Meaning {#meaning}
An event-trigger helper was called without the state it requires. The fixed messages identify sql_drop, table_rewrite, or a general event-trigger function context, so this is a call-context violation rather than an object-existence error.
Diagnosis {#diagnosis}
Identify the helper and required event context from the message. Check whether the call belongs in a sql_drop, table_rewrite, or other event-trigger function.
Response {#response}
Move the helper into the required event-trigger context or remove the invalid call; replaying the same DDL does not change that context.
Versions {#versions}
The locked catalogue records this condition from 9.5.0 in the listed formal snapshots and 19beta3; fixed source coverage is PostgreSQL 18.6.
Related {#related}
Sources {#sources}
See the fixed event_trigger.c helper paths alongside the structured evidence record.
Compare versions
SQLSTATE evidence and recorded runtime versions
claims · identity
{
"claim_id": "identity",
"limits": "",
"method": "Read the fixed definition row.",
"position": 0,
"runtime": [],
"sources": [
"src.errcodes.18.6"
],
"statement": "39P03 is event_trigger_protocol_violated in Class 39."
}claims · event-context
{
"claim_id": "event-context",
"limits": "",
"method": "Read each currentEventTriggerState guard and its message.",
"position": 1,
"runtime": [],
"sources": [
"src.path.event-trigger"
],
"statement": "The core event-trigger functions reject calls outside their required sql_drop, table_rewrite, or event-trigger context with this code."
}claims · function-boundary
{
"claim_id": "function-boundary",
"limits": "",
"method": "Compare the guard with the function named in the message.",
"position": 2,
"runtime": [],
"sources": [
"src.path.event-trigger"
],
"statement": "The message names the required event-trigger function context, so the failing boundary is call context rather than object existence alone."
}messages · message.sql-drop
{
"limits": "",
"message_id": "message.sql-drop",
"path": "",
"position": 0,
"raw": {
"id": "message.sql-drop",
"primary_template": "%s can only be called in a sql_drop event trigger function",
"severity_source": "ERROR",
"sources": [
"src.path.event-trigger"
],
"sqlstate": "39P03"
},
"severity": "ERROR",
"sources": [
"src.path.event-trigger"
],
"templates": [
{
"kind": "primary",
"literal": "can only be called in a sql_drop event trigger function",
"position": 0,
"role": "",
"template": "%s can only be called in a sql_drop event trigger function"
}
]
}messages · message.table-rewrite
{
"limits": "",
"message_id": "message.table-rewrite",
"path": "",
"position": 1,
"raw": {
"id": "message.table-rewrite",
"primary_template": "%s can only be called in a table_rewrite event trigger function",
"severity_source": "ERROR",
"sources": [
"src.path.event-trigger"
],
"sqlstate": "39P03"
},
"severity": "ERROR",
"sources": [
"src.path.event-trigger"
],
"templates": [
{
"kind": "primary",
"literal": "can only be called in a table_rewrite event trigger function",
"position": 0,
"role": "",
"template": "%s can only be called in a table_rewrite event trigger function"
}
]
}messages · message.event-trigger
{
"limits": "",
"message_id": "message.event-trigger",
"path": "",
"position": 2,
"raw": {
"id": "message.event-trigger",
"primary_template": "%s can only be called in an event trigger function",
"severity_source": "ERROR",
"sources": [
"src.path.event-trigger"
],
"sqlstate": "39P03"
},
"severity": "ERROR",
"sources": [
"src.path.event-trigger"
],
"templates": [
{
"kind": "primary",
"literal": "can only be called in an event trigger function",
"position": 0,
"role": "",
"template": "%s can only be called in an event trigger function"
}
]
}sources · src.errcodes.18.6
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/utils/errcodes.txt",
"position": 0,
"sha256": "6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba",
"source_id": "src.errcodes.18.6",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt#L313"
}sources · src.calls.REL_18_6
{
"commit": "",
"docs_url": "",
"kind": "local_artifact",
"location": "",
"path": "raw/calls/REL_18_6.jsonl",
"position": 1,
"sha256": "9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf",
"source_id": "src.calls.REL_18_6",
"tag": "",
"url": ""
}sources · src.path.event-trigger
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/commands/event_trigger.c",
"position": 2,
"sha256": "0c9d6c5da18411f63110aea40635cd82d8e1d591db5931ff37f3a52f53ee69eb",
"source_id": "src.path.event-trigger",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/commands/event_trigger.c#L1542-L1545"
}Source references
Full definition and evidence JSON
Definition sources
center · PostgreSQL 18 · english-manuals:8a70296194d2a159053ae04c00415ef245e36330805120f5a8ed3aafe4f2ac64
Text language: en · english-manuals:8a70296194d2a159053ae04c00415ef245e36330805120f5a8ed3aafe4f2ac64