pgsql: Remove bogus restriction from BEFORE UPDATE triggers

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема pgsql: Remove bogus restriction from BEFORE UPDATE triggers
Дата
Msg-id E1l5DR0-0007tS-PC@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
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(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix hash partition pruning with asymmetric partition sets.
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Silence another gcc 11 warning.