From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Amit Langote <amitlangote09@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andres Freund <andres@anarazel.de>
Cc: Jehan-Guillaume de Rorthais <jgdr@dalibo.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: [BUG] wrong FK constraint name when colliding name on ATTACH
Date: Fri, 9 Sep 2022 12:31:49 +0200
Message-ID: <20220909103149.lk5n3vvb2taxejfp@alvherre.pgsql> (raw)
In-Reply-To: <CA+HiwqH89kx7hmmUw0Eu5oEWEona+QRF39O28ffPaydqjwDGDA@mail.gmail.com>
On 2022-Sep-09, Amit Langote wrote:
> Yes, the loop in GetForeignKeyActionTriggers() needs this:
>
> + /* Only ever look at "action" triggers on the PK side. */
> + if (RI_FKey_trigger_type(trgform->tgfoid) != RI_TRIGGER_PK)
> + continue;
>
> Likewise, GetForeignKeyActionTriggers() needs this:
>
> + /* Only ever look at "check" triggers on the FK side. */
> + if (RI_FKey_trigger_type(trgform->tgfoid) != RI_TRIGGER_FK)
> + continue;
>
> We evidently missed this in f4566345cf40b0.
Ouch. Thank you, pushed.
> On Fri, Sep 9, 2022 at 4:54 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > I'd counsel dropping the early-exit optimization; it doesn't
> > save much I expect, and it evidently hides bugs. Or maybe
> > make it conditional on !USE_ASSERT_CHECKING.
>
> While neither of these functions are called in hot paths, I am
> inclined to keep the early-exit bit in non-assert builds.
I kept it that way.
--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"El hombre nunca sabe de lo que es capaz hasta que lo intenta" (C. Dickens)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: alvherre@alvh.no-ip.org, amitlangote09@gmail.com, tgl@sss.pgh.pa.us, andres@anarazel.de, jgdr@dalibo.com
Subject: Re: [BUG] wrong FK constraint name when colliding name on ATTACH
In-Reply-To: <20220909103149.lk5n3vvb2taxejfp@alvherre.pgsql>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox