summaryrefslogtreecommitdiff
path: root/src/backend/commands/tablecmds.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2023-03-04 13:32:35 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2023-03-04 13:32:35 -0500
commitf61e60102f08305f3cb9e55a7958b8036a02fe39 (patch)
treec2c039a0f98a6ee77493e583e151dd21b67a1e31 /src/backend/commands/tablecmds.c
parent9d41ecfcd9a7cb4ec6b20add4a55603ebba03f0d (diff)
Avoid failure when altering state of partitioned foreign-key triggers.
Beginning in v15, if you apply ALTER TABLE ENABLE/DISABLE TRIGGER to a partitioned table, it also affects the partitions' cloned versions of the affected trigger(s). The initial implementation of this located the clones by name, but that fails on foreign-key triggers which have names incorporating their own OIDs. We can fix that, and also make the behavior more bulletproof in the face of user-initiated trigger renames, by identifying the cloned triggers by tgparentid. Following the lead of earlier commits in this area, I took care not to break ABI in the v15 branch, even though I rather doubt there are any external callers of EnableDisableTrigger. While here, update the documentation, which was not touched when the semantics were changed. Per bug #17817 from Alan Hodgson. Back-patch to v15; older versions do not have this behavior. Discussion: https://postgr.es/m/17817-31dfb7c2100d9f3d@postgresql.org
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r--src/backend/commands/tablecmds.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index b59cc96719e..ce32c79ae06 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -14768,8 +14768,9 @@ ATExecEnableDisableTrigger(Relation rel, const char *trigname,
char fires_when, bool skip_system, bool recurse,
LOCKMODE lockmode)
{
- EnableDisableTriggerNew(rel, trigname, fires_when, skip_system, recurse,
- lockmode);
+ EnableDisableTriggerNew2(rel, trigname, InvalidOid,
+ fires_when, skip_system, recurse,
+ lockmode);
}
/*