On Fri, Mar 11, 2016 at 1:09 PM, Peter Geoghegan <p...@heroku.com> wrote: > Or, you could add code like this to comparetup_index_btree(), to > simulate a broken opclass: > > diff --git a/src/backend/utils/sort/tuplesort.c > b/src/backend/utils/sort/tuplesort.c > index 67d86ed..23712ff 100644 > --- a/src/backend/utils/sort/tuplesort.c > +++ b/src/backend/utils/sort/tuplesort.c > @@ -3562,6 +3562,9 @@ comparetup_index_btree(const SortTuple *a, const > SortTuple *b, > compare = ApplySortComparator(a->datum1, a->isnull1, > > b->datum1, b->isnull1, > sortKey); > + > + if (random() <= (MAX_RANDOM_VALUE / 1000)) > + compare = -compare; > if (compare != 0) > return compare;
Note that this patch that I sketched would make CREATE INDEX produce corrupt indexes, but the tool's verification itself would not be affected. Although even if it was (even if _bt_compare() gave the same wrong answers), it would still very likely detect corruption. -- Peter Geoghegan -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers