diff options
Diffstat (limited to 'src/backend/commands/trigger.c')
-rw-r--r-- | src/backend/commands/trigger.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index d7abde170be..66401f28392 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -1715,7 +1715,8 @@ renametrig_partition(Relation tgrel, Oid partitionId, Oid parentTriggerOid, * to change 'tgenabled' field for the specified trigger(s) * * rel: relation to process (caller must hold suitable lock on it) - * tgname: trigger to process, or NULL to scan all triggers + * tgname: name of trigger to process, or NULL to scan all triggers + * tgparent: if not zero, process only triggers with this tgparentid * fires_when: new value for tgenabled field. In addition to generic * enablement/disablement, this also defines when the trigger * should be fired in session replication roles. @@ -1727,7 +1728,7 @@ renametrig_partition(Relation tgrel, Oid partitionId, Oid parentTriggerOid, * system triggers */ void -EnableDisableTrigger(Relation rel, const char *tgname, +EnableDisableTrigger(Relation rel, const char *tgname, Oid tgparent, char fires_when, bool skip_system, bool recurse, LOCKMODE lockmode) { @@ -1766,6 +1767,9 @@ EnableDisableTrigger(Relation rel, const char *tgname, { Form_pg_trigger oldtrig = (Form_pg_trigger) GETSTRUCT(tuple); + if (OidIsValid(tgparent) && tgparent != oldtrig->tgparentid) + continue; + if (oldtrig->tgisinternal) { /* system trigger ... ok to process? */ @@ -1816,7 +1820,8 @@ EnableDisableTrigger(Relation rel, const char *tgname, Relation part; part = relation_open(partdesc->oids[i], lockmode); - EnableDisableTrigger(part, NameStr(oldtrig->tgname), + /* Match on child triggers' tgparentid, not their name */ + EnableDisableTrigger(part, NULL, oldtrig->oid, fires_when, skip_system, recurse, lockmode); table_close(part, NoLock); /* keep lock till commit */ |