pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Remove bogus restriction from BEFORE UPDATE triggers
2+ messages / 1 participants
[nested] [flat]

* pgsql: Remove bogus restriction from BEFORE UPDATE triggers
@ 2021-01-28 19:58  Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Alvaro Herrera @ 2021-01-28 19:58 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/16f69062e599eccda8aea52301009e63fa96bef4

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(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Remove bogus restriction from BEFORE UPDATE triggers
@ 2021-01-28 19:58  Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Alvaro Herrera @ 2021-01-28 19:58 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2021-01-28 19:58 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-01-28 19:58 pgsql: Remove bogus restriction from BEFORE UPDATE triggers Alvaro Herrera <alvherre@alvh.no-ip.org>
2021-01-28 19:58 pgsql: Remove bogus restriction from BEFORE UPDATE triggers Alvaro Herrera <alvherre@alvh.no-ip.org>

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