Fix building of large (bigger than shared_buffers) hash indexes.
authorTom Lane
Fri, 24 Jun 2016 20:57:36 +0000 (16:57 -0400)
committerTom Lane
Fri, 24 Jun 2016 20:57:36 +0000 (16:57 -0400)
commit07f69137b15e594edfaec29f73efa86aa442902c
treee21f49019b64157b8d82b946ddca7a942ed9e09a
parentb4e6123bf604ed316b03629b881fbf67edcb9725
Fix building of large (bigger than shared_buffers) hash indexes.

When the index is predicted to need more than NBuffers buckets,
CREATE INDEX attempts to sort the index entries by hash key before
insertion, so as to reduce thrashing.  This code path got broken by
commit 9f03ca915196dfc8, which overlooked that _hash_form_tuple() is not
just an alias for index_form_tuple().  The index got built anyway, but
with garbage data, so that searches for pre-existing tuples always
failed.  Fix by refactoring to separate construction of the indexable
data from calling index_form_tuple().

Per bug #14210 from Daniel Newman.  Back-patch to 9.5 where the
bug was introduced.

Report: <20160623162507[email protected]>
src/backend/access/hash/hash.c
src/backend/access/hash/hashutil.c
src/include/access/hash.h