postgresql/src/backend/commands
Alvaro Herrera 8c848cd4b8
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 f4566345cf, 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
2022-09-09 12:22:20 +02:00
..
Makefile Move parallel vacuum code to vacuumparallel.c. 2021-12-23 11:42:52 +05:30
aggregatecmds.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
alter.c Ensure that pg_auth_members.grantor is always valid. 2022-08-18 13:13:02 -04:00
amcmds.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
analyze.c Invent qsort_interruptible(). 2022-07-12 16:30:36 -04:00
async.c Revert the addition of GetMaxBackends() and related stuff. 2022-04-12 14:45:23 -04:00
cluster.c Change internal RelFileNode references to RelFileNumber or RelFileLocator. 2022-07-06 11:39:09 -04:00
collationcmds.c Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
comment.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
constraint.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
conversioncmds.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
copy.c Reject MERGE in CTEs and COPY 2022-08-12 12:05:50 +02:00
copyfrom.c Further reduce warnings with -Wshadow=compatible-local 2022-08-24 12:27:12 +12:00
copyfromparse.c Fix typo in comment. 2022-08-26 16:55:00 +09:00
copyto.c Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
createas.c In extensions, don't replace objects not belonging to the extension. 2022-08-08 11:12:31 -04:00
dbcommands.c Fix ICU locale option handling in CREATE DATABASE 2022-08-24 13:27:34 +02:00
define.c Improve two comments related to a boolean DefElem's value 2022-07-11 11:07:33 +09:00
discard.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
dropcmds.c Use list_copy_head() instead of list_truncate(list_copy(...), ...) 2022-07-13 15:03:47 +12:00
event_trigger.c Ensure that pg_auth_members.grantor is always valid. 2022-08-18 13:13:02 -04:00
explain.c Revert SQL/JSON features 2022-09-01 17:07:14 -04:00
extension.c Fix missed corner cases for grantable permissions on GUCs. 2022-07-19 17:21:55 -04:00
foreigncmds.c In extensions, don't replace objects not belonging to the extension. 2022-08-08 11:12:31 -04:00
functioncmds.c More -Wshadow=compatible-local warning fixes 2022-08-26 02:35:40 +12:00
indexcmds.c Further reduce warnings with -Wshadow=compatible-local 2022-08-24 12:27:12 +12:00
lockcmds.c Add support for security invoker views. 2022-03-22 10:28:10 +00:00
matview.c Change internal RelFileNode references to RelFileNumber or RelFileLocator. 2022-07-06 11:39:09 -04:00
opclasscmds.c Fix DDL deparse of CREATE OPERATOR CLASS 2022-05-20 18:52:55 +02:00
operatorcmds.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
policy.c Add construct_array_builtin, deconstruct_array_builtin 2022-07-01 11:23:15 +02:00
portalcmds.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
prepare.c Replace many MemSet calls with struct initialization 2022-07-16 08:50:49 +02:00
proclang.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
publicationcmds.c Avoid using list_length() to test for empty list. 2022-08-17 11:12:35 -04:00
schemacmds.c In extensions, don't replace objects not belonging to the extension. 2022-08-08 11:12:31 -04:00
seclabel.c Allow granting SET and ALTER SYSTEM privileges on GUC parameters. 2022-04-06 13:24:33 -04:00
sequence.c In extensions, don't replace objects not belonging to the extension. 2022-08-08 11:12:31 -04:00
statscmds.c Avoid using list_length() to test for empty list. 2022-08-17 11:12:35 -04:00
subscriptioncmds.c Raise a warning if there is a possibility of data from multiple origins. 2022-09-08 06:54:13 +05:30
tablecmds.c Fix GetForeignKey*Triggers for self-referential FKs 2022-09-09 12:22:20 +02:00
tablespace.c Replace pgwin32_is_junction() with lstat(). 2022-08-06 12:50:59 +12:00
trigger.c Fix typo in 16d69ec29 2022-09-06 15:59:15 +12:00
tsearchcmds.c Add Boolean node 2022-01-17 10:38:23 +01:00
typecmds.c Avoid using list_length() to test for empty list. 2022-08-17 11:12:35 -04:00
user.c Allow grant-level control of role inheritance behavior. 2022-08-25 10:06:02 -04:00
vacuum.c Derive freeze cutoff from nextXID, not OldestXmin. 2022-08-31 11:37:35 -07:00
vacuumparallel.c Use logical operator && instead of & in vacuumparallel.c. 2022-08-22 08:53:58 +05:30
variable.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
view.c In extensions, don't replace objects not belonging to the extension. 2022-08-08 11:12:31 -04:00