mirror of
https://github.com/postgres/postgres.git
synced 2025-11-04 20:11:56 +03:00
Fix misuse of table_index_fetch_tuple_check().
Commit 0d861bbb, which added deduplication to nbtree, had
_bt_check_unique() pass a TID to table_index_fetch_tuple_check() that
isn't safe to mutate. table_index_fetch_tuple_check()'s tid argument is
modified when the TID in question is not the latest visible tuple in a
hot chain, though this wasn't documented.
To fix, go back to using a local copy of the TID in _bt_check_unique(),
and update comments above table_index_fetch_tuple_check().
Backpatch: 13-, where B-Tree deduplication was introduced.
This commit is contained in:
@@ -196,6 +196,10 @@ table_beginscan_parallel(Relation relation, ParallelTableScanDesc parallel_scan)
|
||||
* optimized, but is unlikely to matter from a performance POV. If there
|
||||
* frequently are live index pointers also matching a unique index key, the
|
||||
* CPU overhead of this routine is unlikely to matter.
|
||||
*
|
||||
* Note that *tid may be modified when we return true if the AM supports
|
||||
* storing multiple row versions reachable via a single index entry (like
|
||||
* heap's HOT).
|
||||
*/
|
||||
bool
|
||||
table_index_fetch_tuple_check(Relation rel,
|
||||
|
||||
Reference in New Issue
Block a user