Skip to content

Commit fdbb979

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 9729f99 commit fdbb979

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
@@ -4173,6 +4173,9 @@ comparetup_index_btree(const SortTuple *a, const SortTuple *b,
41734173
return (pos1 < pos2) ? -1 : 1;
41744174
}
41754175

4176+
/* ItemPointer values should never be equal */
4177+
Assert(false);
4178+
41764179
return 0;
41774180
}
41784181

@@ -4225,6 +4228,9 @@ comparetup_index_hash(const SortTuple *a, const SortTuple *b,
42254228
return (pos1 < pos2) ? -1 : 1;
42264229
}
42274230

4231+
/* ItemPointer values should never be equal */
4232+
Assert(false);
4233+
42284234
return 0;
42294235
}
42304236

0 commit comments

Comments
 (0)