Fix MERGE command tag for actions blocked by BEFORE ROW triggers.
Dean Rasheed <dean.a.rasheed@gmail.com>
Fix MERGE command tag for actions blocked by BEFORE ROW triggers. This ensures that the row count in the command tag for a MERGE is correctly computed in the case where UPDATEs or DELETEs are skipped due to a BEFORE ROW trigger returning NULL (the INSERT case was already handled correctly by ExecMergeNotMatched() calling ExecInsert()). Back-patch to v15, where MERGE was introduced. Discussion: https://postgr.es/m/CAEZATCU8XEmR0JWKDtyb7iZ%3DqCffxS9uyJt0iOZ4TV4RT%2Bow1w%40mail.gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/executor/nodeModifyTable.c | modified | +6 −4 |
| src/test/regress/expected/merge.out | modified | +15 −0 |
| src/test/regress/sql/merge.sql | modified | +13 −0 |
Discussion
- BUG #17809: MERGE ... UPDATE fails with BEFORE ROW UPDATE trigger when target row updated concurrently 7 messages · 2023-02-26 → 2023-03-13