pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix GetForeignKey*Triggers for self-referential FKs
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix GetForeignKey*Triggers for self-referential FKs
@ 2022-09-09 10:23 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Alvaro Herrera @ 2022-09-09 10:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix GetForeignKey*Triggers for self-referential FKs

Because of inadequate filtering, the check triggers were confusing the
search for action triggers in GetForeignKeyActionTriggers and vice-versa
in GetForeignKeyCheckTriggers; this confusion results in seemingly
random assertion failures, and can have real impact in non-asserting
builds depending on catalog order.  Change these functions so that they
correctly ignore triggers that are not relevant to each side.

To reduce the odds of further problems, do not break out of the
searching loop in assertion builds.  This break is likely to hide bugs;
without it, we would have detected this bug immediately.

This problem was introduced by f4566345cf40, so backpatch to 15 where
that commit first appeared.

Author: Amit Langote <amitlangote09@gmail.com>
Discussion: https://postgr.es/m/20220908172029.sejft2ppckbo6oh5@awork3.anarazel.de
Discussion: https://postgr.es/m/4104619.1662663056@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8c848cd4b8e9e0fee33eaad33cb44376b9e5b480

Modified Files
--------------
src/backend/commands/tablecmds.c | 12 ++++++++++++
1 file changed, 12 insertions(+)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix GetForeignKey*Triggers for self-referential FKs
@ 2022-09-09 10:23 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Alvaro Herrera @ 2022-09-09 10:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix GetForeignKey*Triggers for self-referential FKs

Because of inadequate filtering, the check triggers were confusing the
search for action triggers in GetForeignKeyActionTriggers and vice-versa
in GetForeignKeyCheckTriggers; this confusion results in seemingly
random assertion failures, and can have real impact in non-asserting
builds depending on catalog order.  Change these functions so that they
correctly ignore triggers that are not relevant to each side.

To reduce the odds of further problems, do not break out of the
searching loop in assertion builds.  This break is likely to hide bugs;
without it, we would have detected this bug immediately.

This problem was introduced by f4566345cf40, so backpatch to 15 where
that commit first appeared.

Author: Amit Langote <amitlangote09@gmail.com>
Discussion: https://postgr.es/m/20220908172029.sejft2ppckbo6oh5@awork3.anarazel.de
Discussion: https://postgr.es/m/4104619.1662663056@sss.pgh.pa.us

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/68b0da67794e62df53d07956482770cbfbc5e786

Modified Files
--------------
src/backend/commands/tablecmds.c | 12 ++++++++++++
1 file changed, 12 insertions(+)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2022-09-09 10:23 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-09-09 10:23 pgsql: Fix GetForeignKey*Triggers for self-referential FKs Alvaro Herrera <alvherre@alvh.no-ip.org>
2022-09-09 10:23 pgsql: Fix GetForeignKey*Triggers for self-referential FKs Alvaro Herrera <alvherre@alvh.no-ip.org>

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