aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/trigger.c
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2020-10-20 19:22:09 -0300
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2020-10-20 19:22:09 -0300
commit5f6463a20af183db10d372f16ddeb5690a92aa1b (patch)
treed03661c41e2400838f968c412e1bd0169c880f32 /src/backend/commands/trigger.c
parent1f53d0b9f45521a85e85b6dcab7c15a7d8b4b973 (diff)
downloadpostgresql-5f6463a20af183db10d372f16ddeb5690a92aa1b.tar.gz
postgresql-5f6463a20af183db10d372f16ddeb5690a92aa1b.zip
Fix ALTER TABLE .. ENABLE/DISABLE TRIGGER recursion
More precisely, correctly handle the ONLY flag indicating not to recurse. This was implemented in 86f575948c77 by recursing in trigger.c, but that's the wrong place; use ATSimpleRecursion instead, which behaves properly. However, because legacy inheritance has never recursed in that situation, make sure to do that only for new-style partitioning. I noticed this problem while testing a fix for another bug in the vicinity. This has been wrong all along, so backpatch to 11. Discussion: https://postgr.es/m/20201016235925.GA29829@alvherre.pgsql
Diffstat (limited to 'src/backend/commands/trigger.c')
-rw-r--r--src/backend/commands/trigger.c21
1 files changed, 0 insertions, 21 deletions
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c
index 672fccff5bd..bbaa5cdf4b2 100644
--- a/src/backend/commands/trigger.c
+++ b/src/backend/commands/trigger.c
@@ -1530,27 +1530,6 @@ EnableDisableTrigger(Relation rel, const char *tgname,
heap_freetuple(newtup);
- /*
- * When altering FOR EACH ROW triggers on a partitioned table, do
- * the same on the partitions as well.
- */
- if (rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE &&
- (TRIGGER_FOR_ROW(oldtrig->tgtype)))
- {
- PartitionDesc partdesc = RelationGetPartitionDesc(rel);
- int i;
-
- for (i = 0; i < partdesc->nparts; i++)
- {
- Relation part;
-
- part = relation_open(partdesc->oids[i], lockmode);
- EnableDisableTrigger(part, NameStr(oldtrig->tgname),
- fires_when, skip_system, lockmode);
- table_close(part, NoLock); /* keep lock till commit */
- }
- }
-
changed = true;
}