pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix AFTER ROW trigger execution in MERGE cross-partition update.
3+ messages / 1 participants
[nested] [flat]

* pgsql: Fix AFTER ROW trigger execution in MERGE cross-partition update.
@ 2023-11-09 11:30  Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Dean Rasheed @ 2023-11-09 11:30 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix AFTER ROW trigger execution in MERGE cross-partition update.

When executing a MERGE UPDATE action, if the UPDATE is turned into a
cross-partition DELETE then INSERT, do not attempt to invoke AFTER
UPDATE ROW triggers, or any of the other post-update actions in
ExecUpdateEpilogue().

For consistency with a plain UPDATE command, such triggers should not
be fired (and typically fail anyway), and similarly, other post-update
actions, such as WCO/RLS checks should not be executed, and might also
lead to unexpected failures.

Therefore, as with ExecUpdate(), make ExecMergeMatched() return
immediately if ExecUpdateAct() reports that a cross-partition update
was done, to be sure that no further processing is done for that
tuple.

Back-patch to v15, where MERGE was introduced.

Discussion: https://postgr.es/m/CAEZATCWjBgagyNZs02vgDF0DvASYj-iHTFtXG2-nP3orZhmtcw%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a4f7d33a904fcd4da7a12d249416dd2c5c5f2c1c

Modified Files
--------------
src/backend/executor/nodeModifyTable.c | 16 ++++++++++++
src/test/regress/expected/triggers.out | 45 ++++++++++++++++++++++++++++++++++
src/test/regress/sql/triggers.sql      | 36 +++++++++++++++++++++++++++
3 files changed, 97 insertions(+)



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

* pgsql: Fix AFTER ROW trigger execution in MERGE cross-partition update.
@ 2023-11-09 11:30  Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Dean Rasheed @ 2023-11-09 11:30 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix AFTER ROW trigger execution in MERGE cross-partition update.

When executing a MERGE UPDATE action, if the UPDATE is turned into a
cross-partition DELETE then INSERT, do not attempt to invoke AFTER
UPDATE ROW triggers, or any of the other post-update actions in
ExecUpdateEpilogue().

For consistency with a plain UPDATE command, such triggers should not
be fired (and typically fail anyway), and similarly, other post-update
actions, such as WCO/RLS checks should not be executed, and might also
lead to unexpected failures.

Therefore, as with ExecUpdate(), make ExecMergeMatched() return
immediately if ExecUpdateAct() reports that a cross-partition update
was done, to be sure that no further processing is done for that
tuple.

Back-patch to v15, where MERGE was introduced.

Discussion: https://postgr.es/m/CAEZATCWjBgagyNZs02vgDF0DvASYj-iHTFtXG2-nP3orZhmtcw%40mail.gmail.com

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/c0bfdaf2b773d9e0de343c768dfbb89c250ae439

Modified Files
--------------
src/backend/executor/nodeModifyTable.c | 16 ++++++++++++
src/test/regress/expected/triggers.out | 45 ++++++++++++++++++++++++++++++++++
src/test/regress/sql/triggers.sql      | 36 +++++++++++++++++++++++++++
3 files changed, 97 insertions(+)



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

* pgsql: Fix AFTER ROW trigger execution in MERGE cross-partition update.
@ 2023-11-09 11:30  Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Dean Rasheed @ 2023-11-09 11:30 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix AFTER ROW trigger execution in MERGE cross-partition update.

When executing a MERGE UPDATE action, if the UPDATE is turned into a
cross-partition DELETE then INSERT, do not attempt to invoke AFTER
UPDATE ROW triggers, or any of the other post-update actions in
ExecUpdateEpilogue().

For consistency with a plain UPDATE command, such triggers should not
be fired (and typically fail anyway), and similarly, other post-update
actions, such as WCO/RLS checks should not be executed, and might also
lead to unexpected failures.

Therefore, as with ExecUpdate(), make ExecMergeMatched() return
immediately if ExecUpdateAct() reports that a cross-partition update
was done, to be sure that no further processing is done for that
tuple.

Back-patch to v15, where MERGE was introduced.

Discussion: https://postgr.es/m/CAEZATCWjBgagyNZs02vgDF0DvASYj-iHTFtXG2-nP3orZhmtcw%40mail.gmail.com

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/06a546382aafe0cc9d895b2861c5b8a8e9f0b002

Modified Files
--------------
src/backend/executor/nodeModifyTable.c | 16 ++++++++++++
src/test/regress/expected/triggers.out | 45 ++++++++++++++++++++++++++++++++++
src/test/regress/sql/triggers.sql      | 36 +++++++++++++++++++++++++++
3 files changed, 97 insertions(+)



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


end of thread, other threads:[~2023-11-09 11:30 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-11-09 11:30 pgsql: Fix AFTER ROW trigger execution in MERGE cross-partition update. Dean Rasheed <dean.a.rasheed@gmail.com>
2023-11-09 11:30 pgsql: Fix AFTER ROW trigger execution in MERGE cross-partition update. Dean Rasheed <dean.a.rasheed@gmail.com>
2023-11-09 11:30 pgsql: Fix AFTER ROW trigger execution in MERGE cross-partition update. Dean Rasheed <dean.a.rasheed@gmail.com>

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