27000
PostgreSQLERRORNotableTriggered Data Change ViolationHIGH confidence

triggered data change violation

What this means

SQLSTATE 27000 is raised when a trigger or rule attempts to modify a table that is not allowed to be modified in the current trigger firing context — for example, modifying a table during a before-row trigger that is invoked by a foreign key constraint check.

Why it happens
  1. 1A trigger attempts to modify a table that is the subject of the triggering operation in a prohibited way
  2. 2A rule attempts a data modification that violates trigger-based constraints
How to reproduce

Trigger attempting to modify the triggering table in an illegal way.

expected output

ERROR:  triggered data change violation

Fix

Refactor trigger logic to avoid prohibited modifications

WHEN When a trigger causes 27000.

Why this works

Review the trigger to ensure it does not modify tables in a way that violates the current execution context. Use AFTER triggers instead of BEFORE triggers for complex modifications, or use deferred constraints.

Sources
Official documentation ↗

Class 27 — Triggered Data Change Violation

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All PostgreSQL errors