aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/trigger.c
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2021-01-28 16:56:07 -0300
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2021-01-28 16:56:07 -0300
commit16f69062e599eccda8aea52301009e63fa96bef4 (patch)
treef2a7aa479881db9a3e893a497783a3d4837ca4ef /src/backend/commands/trigger.c
parent7f1921cb922879796f7946273db304922a439a58 (diff)
downloadpostgresql-16f69062e599eccda8aea52301009e63fa96bef4.tar.gz
postgresql-16f69062e599eccda8aea52301009e63fa96bef4.zip
Remove bogus restriction from BEFORE UPDATE triggers
In trying to protect the user from inconsistent behavior, commit 487e9861d0cf "Enable BEFORE row-level triggers for partitioned tables" tried to prevent BEFORE UPDATE FOR EACH ROW triggers from moving the row from one partition to another. However, it turns out that the restriction is wrong in two ways: first, it fails spuriously, preventing valid situations from working, as in bug #16794; and second, they don't protect from any misbehavior, because tuple routing would cope anyway. Fix by removing that restriction. We keep the same restriction on BEFORE INSERT FOR EACH ROW triggers, though. It is valid and useful there. In the future we could remove it by having tuple reroute work for inserts as it does for updates. Backpatch to 13. Author: Álvaro Herrera <alvherre@alvh.no-ip.org> Reported-by: Phillip Menke <pg@pmenke.de> Discussion: https://postgr.es/m/16794-350a655580fbb9ae@postgresql.org
Diffstat (limited to 'src/backend/commands/trigger.c')
-rw-r--r--src/backend/commands/trigger.c10
1 files changed, 0 insertions, 10 deletions
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c
index 9361a1417b6..29d58c6be51 100644
--- a/src/backend/commands/trigger.c
+++ b/src/backend/commands/trigger.c
@@ -2726,16 +2726,6 @@ ExecBRUpdateTriggers(EState *estate, EPQState *epqstate,
{
ExecForceStoreHeapTuple(newtuple, newslot, false);
- if (trigger->tgisclone &&
- !ExecPartitionCheck(relinfo, newslot, estate, false))
- ereport(ERROR,
- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("moving row to another partition during a BEFORE trigger is not supported"),
- errdetail("Before executing trigger \"%s\", the row was to be in partition \"%s.%s\".",
- trigger->tgname,
- get_namespace_name(RelationGetNamespace(relinfo->ri_RelationDesc)),
- RelationGetRelationName(relinfo->ri_RelationDesc))));
-
/*
* If the tuple returned by the trigger / being stored, is the old
* row version, and the heap tuple passed to the trigger was