Re: BUG #18516: Foreign key data integrity is not validated when reenabled the trigger on tables

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Mujjamil k <mujjamil995(at)gmail(dot)com>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18516: Foreign key data integrity is not validated when reenabled the trigger on tables
Date: 2024-06-20 15:50:57
Message-ID: 354613.1718898657@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> writes:
> I think it's not a bad idea to suggest that we could have a new command
> ALTER TABLE .. DISABLE CONSTRAINT, which can be run by the table owner
> and paired with a later ALTER TABLE ENABLE CONSTRAINT, which verifies
> the constraint.

The existing, supported way to do this is to drop the foreign key
constraint and then later re-create it.

As noted, if you mess with the triggers directly then any subsequent
breakage is your responsibility.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2024-06-20 16:43:36 Re: BUG #18517: Dropping a table referenced by an initially deferred foreign key fails with an error
Previous Message Melanie Plageman 2024-06-20 15:49:50 Re: relfrozenxid may disagree with row XIDs after 1ccc1e05ae