diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2016-06-24 16:57:36 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2016-06-24 16:57:36 -0400 |
commit | 07f69137b15e594edfaec29f73efa86aa442902c (patch) | |
tree | e21f49019b64157b8d82b946ddca7a942ed9e09a /src/include/access/hash.h | |
parent | b4e6123bf604ed316b03629b881fbf67edcb9725 (diff) |
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.17237.39471@wrigleys.postgresql.org>
Diffstat (limited to 'src/include/access/hash.h')
-rw-r--r-- | src/include/access/hash.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/include/access/hash.h b/src/include/access/hash.h index 93cc8afcebc..52fb6fe3d4b 100644 --- a/src/include/access/hash.h +++ b/src/include/access/hash.h @@ -350,8 +350,9 @@ extern Bucket _hash_hashkey2bucket(uint32 hashkey, uint32 maxbucket, extern uint32 _hash_log2(uint32 num); extern void _hash_checkpage(Relation rel, Buffer buf, int flags); extern uint32 _hash_get_indextuple_hashkey(IndexTuple itup); -extern IndexTuple _hash_form_tuple(Relation index, - Datum *values, bool *isnull); +extern bool _hash_convert_tuple(Relation index, + Datum *user_values, bool *user_isnull, + Datum *index_values, bool *index_isnull); extern OffsetNumber _hash_binsearch(Page page, uint32 hash_value); extern OffsetNumber _hash_binsearch_last(Page page, uint32 hash_value); |