summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Geoghegan <pg@bowt.ie>2020-07-29 16:00:48 -0700
committerPeter Geoghegan <pg@bowt.ie>2020-07-29 16:00:48 -0700
commitb6608ae5d3cc16005d4fd4f1be2790e3ad566892 (patch)
treefbe7de9cc402d97fe8634c9ca255fa70c1a5f1f4 /src
parentaaa132a65deb232125a999184857aaacf3140680 (diff)
Backpatch tuplesort.c assertion.
Backpatch an assertion (that was originally added to Postgres 12 by commit dd299df8189) 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
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/sort/tuplesort.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c
index b6951d4ac93..1a7a08ea946 100644
--- a/src/backend/utils/sort/tuplesort.c
+++ b/src/backend/utils/sort/tuplesort.c
@@ -3682,6 +3682,9 @@ comparetup_index_btree(const SortTuple *a, const SortTuple *b,
return (pos1 < pos2) ? -1 : 1;
}
+ /* ItemPointer values should never be equal */
+ Assert(false);
+
return 0;
}
@@ -3731,6 +3734,9 @@ comparetup_index_hash(const SortTuple *a, const SortTuple *b,
return (pos1 < pos2) ? -1 : 1;
}
+ /* ItemPointer values should never be equal */
+ Assert(false);
+
return 0;
}