Fix assertions with RI triggers in heap_update and heap_delete.
authorHeikki Linnakangas
Tue, 28 Nov 2023 09:59:09 +0000 (11:59 +0200)
committerHeikki Linnakangas
Tue, 28 Nov 2023 09:59:45 +0000 (11:59 +0200)
commit9fee3232a1d3661981c3cbf87227bfd02ee36c7b
tree54feb97c514acbb01ae051bcf4c5a59854c6f09e
parent07cb7bc1c7a88299e6bce281320397f07ca045c2
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
src/backend/access/heap/heapam.c
src/include/access/tableam.h
src/test/isolation/expected/fk-snapshot.out
src/test/isolation/specs/fk-snapshot.spec