postgresql/contrib/hstore
Tom Lane 73912e7fbd Fix GIN to support null keys, empty and null items, and full index scans.
Per my recent proposal(s).  Null key datums can now be returned by
extractValue and extractQuery functions, and will be stored in the index.
Also, placeholder entries are made for indexable items that are NULL or
contain no keys according to extractValue.  This means that the index is
now always complete, having at least one entry for every indexed heap TID,
and so we can get rid of the prohibition on full-index scans.  A full-index
scan is implemented much the same way as partial-match scans were already:
we build a bitmap representing all the TIDs found in the index, and then
drive the results off that.

Also, introduce a concept of a "search mode" that can be requested by
extractQuery when the operator requires matching to empty items (this is
just as cheap as matching to a single key) or requires a full index scan
(which is not so cheap, but it sure beats failing or giving wrong answers).
The behavior remains backward compatible for opclasses that don't return
any null keys or request a non-default search mode.

Using these features, we can now make the GIN index opclass for anyarray
behave in a way that matches the actual anyarray operators for &&, <@, @>,
and = ... which it failed to do before in assorted corner cases.

This commit fixes the core GIN code and ginarrayprocs.c, updates the
documentation, and adds some simple regression test cases for the new
behaviors using the array operators.  The tsearch and contrib GIN opclass
support functions still need to be looked over and probably fixed.

Another thing I intend to fix separately is that this is pretty inefficient
for cases where more than one scan condition needs a full-index search:
we'll run duplicate GinScanEntrys, each one of which builds a large bitmap.
There is some existing logic to merge duplicate GinScanEntrys but it needs
refactoring to make it work for entries belonging to different scan keys.

Note that most of gin.h has been split out into a new file gin_private.h,
so that gin.h doesn't export anything that's not supposed to be used by GIN
opclasses or the rest of the backend.  I did quite a bit of other code
beautification work as well, mostly fixing comments and choosing more
appropriate names for things.
2011-01-07 19:16:24 -05:00
..
data Add GIN support for pg_trgm. From Guillaume Smet <guillaume.smet@gmail.com> 2007-03-14 14:21:53 +00:00
expected Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
sql Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
.gitignore Some more gitignore cleanups: cover contrib and PL regression test outputs. 2010-09-22 17:22:40 -04:00
Makefile Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
crc32.c Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
crc32.h Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
hstore.h Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
hstore.sql.in Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
hstore_compat.c Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
hstore_gin.c Fix GIN to support null keys, empty and null items, and full index scans. 2011-01-07 19:16:24 -05:00
hstore_gist.c Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
hstore_io.c Use memcmp() rather than strncmp() when shorter string length is known. 2010-12-21 22:11:40 -05:00
hstore_op.c Use memcmp() rather than strncmp() when shorter string length is known. 2010-12-21 22:11:40 -05:00
uninstall_hstore.sql Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00