select open change scope Open full search

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

SQLSTATE / CLASS 09 · TRIGGERED ACTION EXCEPTION

triggered_action_exception

SQLSTATE
09000
Condition name
triggered_action_exception
Class
Triggered Action Exception
Source macro
ERRCODE_TRIGGERED_ACTION_EXCEPTION
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>09000</h1>

At a glance

SQLSTATE 09000 is an ERROR-level triggered-action condition. In the fixed PostgreSQL 18.6 scan, resolved report paths are in contrib/spi trigger functions: they validate trigger arguments, target-column types, referenced tuples, and SPI return codes. The code is therefore tied to those installed trigger functions and their table/trigger configuration; it is not a label for every trigger failure.

Meaning

The confirmed paths include autoinc.c, insert_username.c, moddatetime.c, and refint.c. Their message variants include "%s" has no attribute "%s", attribute "%s" of "%s" must be type INT4, ... TEXT, or ... TIMESTAMP or TIMESTAMPTZ. Referential-integrity support also reports tuple references non-existent key with detail Trigger "%s" found tuple referencing non-existent key in "%s"., can report SPI_execp returned %d, and can report "%s": tuple is referenced in "%s" for a restrictive action. These formats contain relation, argument, attribute, trigger, and return-code values supplied by the failing path.

Messages

The confirmed paths include autoinc.c, insert_username.c, moddatetime.c, and refint.c. Their message variants include "%s" has no attribute "%s", attribute "%s" of "%s" must be type INT4, ... TEXT, or ... TIMESTAMP or TIMESTAMPTZ. Referential-integrity support also reports tuple references non-existent key with detail Trigger "%s" found tuple referencing non-existent key in "%s"., can report SPI_execp returned %d, and can report "%s": tuple is referenced in "%s" for a restrictive action. These formats contain relation, argument, attribute, trigger, and return-code values supplied by the failing path.

Diagnosis

First identify the installed trigger function and operation phase, then compare the relation and trigger arguments with the function's documented contract. For an attribute/type message, inspect the named column and its type; for the refint variants, inspect the trigger name, referenced relation, and the tuple or key relationship. For SPI_execp returned %d, preserve the numeric return code and inspect the SPI call that returned it. The fixed scan does not establish a single message for all 09000 reports.

Response

Correct the trigger definition, argument list, column type, referenced key, or SPI-side failure identified by the message, then rerun the triggering operation after verifying the change. Do not repair this by blindly replaying a write: a trigger may have performed work before the error, and the correct boundary depends on the surrounding transaction. If the function is supplied by an extension or local code, inspect that implementation and its version before changing application retry behavior.

Versions

The locked catalogue places this condition at least by PostgreSQL 7.4. The release definitions cover the published snapshots listed in the facts block; source-path status is limited to the fixed PostgreSQL 18.6 context cited below.

Sources

autoinc.c, insert_username.c, moddatetime.c, and refint.c and its referential-restriction branch show the fixed emitters; the SPI trigger documentation describes the extension interface. See the structured evidence record for fixed source paths, scan scope, and unresolved runtime boundaries.

Source evidence

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

09000 is triggered_action_exception in SQLSTATE Class 09.

Method: Read the fixed errcodes definition row, severity, and macro.

src.errcodes.18.6

The fixed PostgreSQL 18.6 source contains the report path and message context described on the page.

Method: Read the complete source context around the resolved report group.

Limits: This is source confirmation, not a runtime observation in this batch.

src.spi.autoinc.18.6 src.spi.insert_username.18.6 src.spi.moddatetime.18.6 src.spi.refint.18.6

The locked release definitions establish catalogue presence from the known 7.4 boundary; they do not establish a precise introducing release or runtime use.

Method: Compare canonical release-definition facts with the available history boundary.

Limits: Definition presence is not an emitting-path observation.

src.errcodes.18.6

Message templates

ERROR · message.autoinc-missing-attribute

Primary

"%s" has no attribute "%s"

Relation and attribute names are dynamic.

ERROR · message.autoinc-invalid-type

Primary

attribute "%s" of "%s" must be type INT4

Attribute and relation names are dynamic.

ERROR · message.insert-username-missing-attribute

Primary

"%s" has no attribute "%s"

Relation and attribute names are dynamic.

ERROR · message.insert-username-invalid-type

Primary

attribute "%s" of "%s" must be type TEXT

Attribute and relation names are dynamic.

ERROR · message.moddatetime-missing-attribute

Primary

"%s" has no attribute "%s"

Relation and attribute names are dynamic.

ERROR · message.moddatetime-invalid-type

Primary

attribute "%s" of "%s" must be type TIMESTAMP or TIMESTAMPTZ

Attribute and relation names are dynamic.

ERROR · message.refint-missing-key

Primary

tuple references non-existent key

Detail

Trigger "%s" found tuple referencing non-existent key in "%s".

Trigger and relation names in DETAIL are dynamic.

ERROR · message.refint-spi-status

Primary

SPI_execp returned %d

The SPI status code is dynamic.

ERROR · message.refint-restrictive

Primary

"%s": tuple is referenced in "%s"

Referencing relation names are dynamic; this is the restrictive action path.

Reproduction & repair cases

No reproduction case is attached to this condition.

Recorded runtime evidence

No runtime observation is attached to this entry.

Definition snapshot: english-manuals:0c102f10f9b78e4b8f97b1750b9… · English manual source