Re: Trigger violates foreign key constraint - Mailing list pgsql-hackers

From Laurenz Albe
Subject Re: Trigger violates foreign key constraint
Date
Msg-id 92d375c65b38d69af7fb05062ebb2ea18e09f14b.camel@cybertec.at
Whole thread Raw
In response to Re: Trigger violates foreign key constraint  (Pavel Luzanov <p.luzanov@postgrespro.ru>)
Responses Re: Trigger violates foreign key constraint
Re: Trigger violates foreign key constraint
List pgsql-hackers
On Fri, 2023-12-22 at 10:59 +0300, Pavel Luzanov wrote:
> Please, consider small suggestion to replace last sentence.
>
> - This is not considered a bug, and it is the responsibility of the user
> to write triggers so that such problems are avoided.
> + It is the trigger programmer's responsibility to avoid such scenarios.
>
> To be consistent with the sentence about recursive trigger calls: [1]
> "It is the trigger programmer's responsibility to avoid infinite
> recursion in such scenarios."

Yes, that is better - shorter and avoids passive mode.  Changed.

> Also I don't really like "This is not considered a bug" part, since it
> looks like an excuse.

In a way, it is an excuse, so why not be honest about it.

The example you provided in your other message (cascading triggers
fail if the table ovner has revoked the required permissions from
herself) is not really about breaking foreign keys.  You hit a
surprising error, but referential integrity will be maintained.

Patch v3 is attached.

Yours,
Laurenz Albe

Attachment

pgsql-hackers by date:

Previous
From: "Daniel Verite"
Date:
Subject: Re: Built-in CTYPE provider
Next
From: Junwang Zhao
Date:
Subject: Re: Transaction timeout