Skip to content

Commit b6608ae

Browse files
Backpatch tuplesort.c assertion.
Backpatch an assertion (that was originally added to Postgres 12 by commit dd299df) that seems broadly useful. The assertion can detect violations of the HOT invariant (i.e. no two index tuples can point to the same heap TID) when CREATE INDEX somehow incorrectly allows that to take place. For example, a IndexBuildHeapScan/heapam_index_build_range_scan bug might result in two tuples that both point to the same heap TID. If these two tuples also happen to be duplicates, the assertion will fail. Discussion: https://postgr.es/m/CAH2-WzmBxu4o=pMsniur+bwHqCGCmV_AOLkuK6BuU7ngA6evqw@mail.gmail.com Backpatch: 9.5-11 only
1 parent aaa132a commit b6608ae

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/backend/utils/sort/tuplesort.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3682,6 +3682,9 @@ comparetup_index_btree(const SortTuple *a, const SortTuple *b,
36823682
return (pos1 < pos2) ? -1 : 1;
36833683
}
36843684

3685+
/* ItemPointer values should never be equal */
3686+
Assert(false);
3687+
36853688
return 0;
36863689
}
36873690

@@ -3731,6 +3734,9 @@ comparetup_index_hash(const SortTuple *a, const SortTuple *b,
37313734
return (pos1 < pos2) ? -1 : 1;
37323735
}
37333736

3737+
/* ItemPointer values should never be equal */
3738+
Assert(false);
3739+
37343740
return 0;
37353741
}
37363742

0 commit comments

Comments
 (0)