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

From: Mujjamil k <mujjamil995(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: 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 13:31:02
Message-ID: CAFvoc==14m-k=SnUM7izgf=NjvMWuY734JXVwCVx3Q2fAe+0fA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Thank you Alvaro for your feedback.

Your suggestion of introducing a new command, ALTER TABLE .. DISABLE
CONSTRAINT, which can be run by the table owner and paired with a later
ALTER TABLE ENABLE CONSTRAINT, is a thoughtful approach. It would allow for
more controlled management of constraints while maintaining data integrity.

On Thu, Jun 20, 2024 at 6:37 PM Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
wrote:

> On 2024-Jun-20, Mujjamil k wrote:
>
> > Thank you, Laurenz, for your valuable feedback. If the enabling system
> > trigger doesn’t check the data integrity with the parent table, then this
> > syntax (ALTER TABLE DISABLE/ENABLE TRIGGER *ALL*) should be removed from
> > PostgreSQL. Otherwise, it will create confusion for the users.
>
> Well, we're not doing that.
>
> This is documented; the page
> https://www.postgresql.org/docs/devel/sql-altertable.html
> contains, under "DISABLE/ENABLE [ REPLICA | ALWAYS ] TRIGGER", the
> following very explicit text:
>
> : Disabling or enabling internally generated constraint triggers requires
> : superuser privileges; it should be done with caution since of course the
> : integrity of the constraint cannot be guaranteed if the triggers are not
> : executed.
>
> There's a reason you were forced to become superuser in order to do
> this. Anytime you're forced to become superuser, you should take a step
> back and think carefully what you're doing.
>
>
> 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.
>
> --
> Álvaro Herrera 48°01'N 7°57'E —
> https://www.EnterpriseDB.com/
> "Entristecido, Wutra (canción de Las Barreras)
> echa a Freyr a rodar
> y a nosotros al mar"
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2024-06-20 15:33:29 BUG #18518: ::timestamp add minutes and seconds to the converted values
Previous Message Alvaro Herrera 2024-06-20 13:07:44 Re: BUG #18516: Foreign key data integrity is not validated when reenabled the trigger on tables