Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b1df6b6

Browse files
committed
Fix potential SSI hazard in heap_update().
Commit 6f38d4d failed to heed a warning about the stability of the value pointed to by "otid". The caller is allowed to pass in a pointer to newtup->t_self, which will be updated during the execution of the function. Instead, the SSI check should use the value we copy into oldtup.t_self near the top of the function. Not a live bug, because newtup->t_self doesn't really get updated until a bit later, but it was confusing and broke the rule established by the comment. Back-patch to 13. Reported-by: Tom Lane <[email protected]> Discussion: https://postgr.es/m/2689164.1618160085%40sss.pgh.pa.us
1 parent 885a876 commit b1df6b6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/backend/access/heap/heapam.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3900,7 +3900,8 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
39003900
* will include checking the relation level, there is no benefit to a
39013901
* separate check for the new tuple.
39023902
*/
3903-
CheckForSerializableConflictIn(relation, otid, BufferGetBlockNumber(buffer));
3903+
CheckForSerializableConflictIn(relation, &oldtup.t_self,
3904+
BufferGetBlockNumber(buffer));
39043905

39053906
/*
39063907
* At this point newbuf and buffer are both pinned and locked, and newbuf

0 commit comments

Comments
 (0)