Fix assertions with RI triggers in heap_update and heap_delete.
Heikki Linnakangas <heikki.linnakangas@iki.fi>
Fix assertions with RI triggers in heap_update and heap_delete. If the tuple being updated is not visible to the crosscheck snapshot, we return TM_Updated but the assertions would not hold in that case. Move them to before the cross-check. Fixes bug #17893. Backpatch to all supported versions. Author: Alexander Lakhin Backpatch-through: 12 Discussion: https://www.postgresql.org/message-id/17893-35847009eec517b5%40postgresql.org
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/access/heap/heapam.c | modified | +24 −17 |
| src/include/access/tableam.h | modified | +2 −2 |
| src/test/isolation/expected/fk-snapshot.out | modified | +22 −0 |
| src/test/isolation/specs/fk-snapshot.spec | modified | +16 −1 |
Discussion
- BUG #17893: Assert failed in heap_update()/_delete() when FK modiified by RI trigger in non-read-committed xact 6 messages · 2023-04-12 → 2023-11-28