Re: Trigger violates foreign key constraint

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Aleksander Alekseev <aleksander@timescale.com>
Cc: pgsql-hackers@postgresql.org, Laurenz Albe <laurenz.albe@cybertec.at>, Pavel Luzanov <p.luzanov@postgrespro.ru>, "David G. Johnston" <david.g.johnston@gmail.com>
Date: 2024-05-08T15:14:18Z
Lists: pgsql-hackers
Aleksander Alekseev <aleksander@timescale.com> writes:
>> Perhaps we should leave the system triggers out of the discussion
>> entirely?  More or less like:
>> 
>> If a foreign key constraint specifies referential actions (that
>> is, cascading updates or deletes), those actions are performed via
>> ordinary SQL update or delete commands on the referencing table.
>> In particular, any triggers that exist on the referencing table
>> will be fired for those changes.  If such a trigger modifies or
>> blocks the effect of one of these commands, the end result could
>> be to break referential integrity.  It is the trigger programmer's
>> responsibility to avoid that.

> That's perfect!

Hearing no further comments, done like that.

			regards, tom lane



Commits

  1. Doc: document that triggers can break referential integrity.