From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove bogus restriction from BEFORE UPDATE triggers
Date: Thu, 28 Jan 2021 19:58:30 +0000
Message-ID: <E1l5DR0-0007tR-Oj@gemulon.postgresql.org> (raw)
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
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/6f5c8a8ec23f8ab00da4d2b77bfc8af2a578c4d3
Modified Files
--------------
doc/src/sgml/ddl.sgml | 4 +--
src/backend/commands/trigger.c | 10 ------
src/test/regress/expected/triggers.out | 57 ++++++++++++++++++++++++++++------
src/test/regress/sql/triggers.sql | 28 ++++++++++++++++-
4 files changed, 77 insertions(+), 22 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: alvherre@alvh.no-ip.org
Subject: Re: pgsql: Remove bogus restriction from BEFORE UPDATE triggers
In-Reply-To: <E1l5DR0-0007tR-Oj@gemulon.postgresql.org>
References: <E1l5DR0-0007tR-Oj@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox