select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

SQLSTATE / CLASS 39 · EXTERNAL ROUTINE INVOCATION EXCEPTION

event_trigger_protocol_violated

SQLSTATE
39P03
Condition name
event_trigger_protocol_violated
Class
External Routine Invocation Exception
Source macro
ERRCODE_E_R_I_E_EVENT_TRIGGER_PROTOCOL_VIOLATED
Evidence
Source path confirmed
Analysis & operational context

English SQLSTATE atlas: authored explanations and source/runtime evidence are separate from the manual definitions. View source ↗

<h1>39P03</h1>

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

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

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

Move the helper into the required event-trigger context or remove the invalid call; replaying the same DDL does not change that context.

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.

Sources

See the fixed event_trigger.c helper paths alongside the structured evidence record.

Source evidence

Evidence belongs to the frozen source and runtime versions listed here. It is not a runtime verification of the selected manual version.

39P03 is event_trigger_protocol_violated in Class 39.

Method: Read the fixed definition row.

src.errcodes.18.6

The core event-trigger functions reject calls outside their required sql_drop, table_rewrite, or event-trigger context with this code.

Method: Read each currentEventTriggerState guard and its message.

src.path.event-trigger

The message names the required event-trigger function context, so the failing boundary is call context rather than object existence alone.

Method: Compare the guard with the function named in the message.

src.path.event-trigger

Message templates

ERROR · message.sql-drop

Primary

%s can only be called in a sql_drop event trigger function
ERROR · message.table-rewrite

Primary

%s can only be called in a table_rewrite event trigger function
ERROR · message.event-trigger

Primary

%s can only be called in an event trigger function

Reproduction & repair cases

No reproduction case is attached to this condition.

Recorded runtime evidence

No runtime observation is attached to this entry.

Version history 1
  1. PG 9.4 → 9.5added

Definition snapshot: english-manuals:67470c5a85f6aea3ee2c6223963… · English manual source