select open change scope Open full search

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

SQLSTATE / CLASS 27 · TRIGGERED DATA CHANGE VIOLATION

triggered_data_change_violation

SQLSTATE
27000
Condition name
triggered_data_change_violation
Class
Triggered Data Change Violation
Source macro
ERRCODE_TRIGGERED_DATA_CHANGE_VIOLATION
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>27000 — triggered_data_change_violation</h1>

At a glance

27000 is a source-confirmed trigger-protection condition. PostgreSQL raises it when a row has already been changed by an operation triggered by the current command; the fixed 18.6 source hint points toward using an AFTER trigger when the intent is to propagate changes to other rows. A naive self-updating BEFORE trigger can recurse or alter the trigger semantics, so this entry does not present it as a safe generic reproduction.

Meaning

27000 is the trigger data change violation raised by the executor when a tuple has already been modified by an operation triggered by the current command. The fixed trigger.c path is specifically a same-command, same-tuple guard for a trigger-driven change; it is not a label for every trigger exception or recursive trigger.

Diagnosis

Start with the target relation, the statement's affected row, and the BEFORE row triggers that can update that row. The fixed primary template is tuple to be updated was already modified by an operation triggered by the current command, with a hint to consider an AFTER trigger for propagating changes to other rows. A self-update test that merely recurses is a different failure and does not establish this path. This batch has no natural runtime observation, so record the actual transaction state from the client if a real trigger error occurs.

Response

If the trigger is propagating a change to another row, an AFTER trigger or one set-based statement may fit the intended semantics; redesign the trigger when the same tuple is legitimately targeted twice. Do not respond with a generic retry or CASCADE, and do not claim that rolling back a fabricated self-update reproduces 27000. Roll back a genuinely failed explicit transaction before issuing repair SQL.

Versions

The locked facts table records catalogue presence across the project snapshot range. The fixed source evidence is limited to the path stated below; no exact behavioral introduction or broader runtime coverage is inferred from the definition alone.

Sources

  • src.errcodes.18.6 (SHA-256 6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba)
  • source path (SHA-256 0a539af85b0de1a04779f92202e7bfc77d85ae6da1747ea32527c67f39084fbd)

Source evidence

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

27000 is the triggered_data_change_violation condition in Class 27.

Method: Read the fixed errcodes.txt row and macro mapping.

Limits: This records the protocol definition and does not imply a natural PostgreSQL throw path.

src.errcodes.18.6

tuple to be updated was already modified by an operation triggered by the current command is a source-confirmed path for 27000.

Method: Trace the fixed source call scan and classify the path before selecting a safe runner case.

Limits: No representative runtime case is claimed; the path requires a specialized internal or trigger/procedure context.

src.trigger.18.6 src.calls.REL_18_6

Message templates

ERROR · message.triggered-data-change

Primary

tuple to be updated was already modified by an operation triggered by the current command

The hint and any row identity are contextual; this is the fixed BEFORE-trigger same-tuple branch.

ERROR · message.triggered-data-change-hint

Hint

Consider using an AFTER trigger instead of a BEFORE trigger to propagate changes to other rows.

The hint describes this source branch and is not a universal trigger migration rule.

Reproduction & repair cases

triggered_data_change_boundary · PG 10, 18

Preconditions

  • A runner-owned disposable target is provisioned.

Trigger: No artificial trigger is executed; the page records the fixed source path and its safe-case boundary.

Expected assertions

    Repair: Use the source-confirmed trigger design and test it separately when the application can control the affected-row semantics.

    Cleanup: Drop the case schema with an owner connection.

    Recorded runtime evidence

    No runtime observation is attached to this entry.

    Definition snapshot: english-manuals:79c493226488cd8895cd087a50c… · English manual source