Re: [BUG] wrong FK constraint name when colliding name on ATTACH

2022-09-09 Thread Alvaro Herrera
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,

Re: [BUG] wrong FK constraint name when colliding name on ATTACH

2022-09-09 Thread Amit Langote
On Fri, Sep 9, 2022 at 4:54 AM Tom Lane wrote: > Andres Freund writes: > > Something here doesn't look to be quite right. Starting with this commit CI > > [1] started to fail on freebsd (stack trace [2]), and in the meson branch > > I've > > also seen the crash on windows (CI run[3], stack

Re: [BUG] wrong FK constraint name when colliding name on ATTACH

2022-09-08 Thread Tom Lane
Andres Freund writes: > Something here doesn't look to be quite right. Starting with this commit CI > [1] started to fail on freebsd (stack trace [2]), and in the meson branch I've > also seen the crash on windows (CI run[3], stack trace [4]). The crash seems 100% reproducible if I remove the

Re: [BUG] wrong FK constraint name when colliding name on ATTACH

2022-09-08 Thread Andres Freund
Hi, On 2022-09-08 13:25:15 +0200, Alvaro Herrera wrote: > I think you're right, so pushed, and backpatched to 12. I added the > test case to regression also. Something here doesn't look to be quite right. Starting with this commit CI [1] started to fail on freebsd (stack trace [2]), and in the

Re: [BUG] wrong FK constraint name when colliding name on ATTACH

2022-09-08 Thread Jehan-Guillaume de Rorthais
On Thu, 8 Sep 2022 13:25:15 +0200 Alvaro Herrera wrote: > On 2022-Sep-08, Jehan-Guillaume de Rorthais wrote: > > > Hi there, > > > > I believe this very small bug and its fix are really trivial and could be > > push out of the way quite quickly. It's just about a bad constraint name > > fixed

Re: [BUG] wrong FK constraint name when colliding name on ATTACH

2022-09-08 Thread Alvaro Herrera
On 2022-Sep-08, Jehan-Guillaume de Rorthais wrote: > Hi there, > > I believe this very small bug and its fix are really trivial and could be push > out of the way quite quickly. It's just about a bad constraint name fixed by > moving one assignation after the next one. This could easily be fixed

Re: [BUG] wrong FK constraint name when colliding name on ATTACH

2022-09-08 Thread Jehan-Guillaume de Rorthais
Hi there, I believe this very small bug and its fix are really trivial and could be push out of the way quite quickly. It's just about a bad constraint name fixed by moving one assignation after the next one. This could easily be fixed for next round of releases. Well, I hope I'm not wrong :)

[BUG] wrong FK constraint name when colliding name on ATTACH

2022-09-01 Thread Jehan-Guillaume de Rorthais
Hi, While studying and hacking on the parenting constraint issue, I found an incoherent piece of code leading to badly chosen fk name. If a constraint name collision is detected, while choosing a new name for the constraint, the code uses fkconstraint->fk_attrs which is not yet populated: /*