postgresql/src/backend
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
..
access Fix GIN to support null keys, empty and null items, and full index scans. 2011-01-07 19:16:24 -05:00
bootstrap Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
catalog New system view pg_stat_replication displays activity of wal sender processes. 2011-01-07 20:35:38 +09:00
commands Improve C comments about backend variables set by pg_upgrade_support 2011-01-06 22:45:36 -05:00
executor Basic foreign table support. 2011-01-01 23:48:11 -05:00
foreign Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
lib Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
libpq Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
main Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
nodes Basic foreign table support. 2011-01-01 23:48:11 -05:00
optimizer Basic foreign table support. 2011-01-01 23:48:11 -05:00
parser Fix crash in ALTER OPERATOR CLASS/FAMILY .. SET SCHEMA. 2011-01-03 22:08:55 -05:00
po Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
port Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
postmaster Add views and functions to monitor hot standby query conflicts 2011-01-03 12:46:03 +01:00
regex Fix comparisons of pointers with zero to compare with NULL instead. 2010-10-29 15:51:52 -04:00
replication New system view pg_stat_replication displays activity of wal sender processes. 2011-01-07 20:35:38 +09:00
rewrite Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
snowball Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
storage Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
tcop Add views and functions to monitor hot standby query conflicts 2011-01-03 12:46:03 +01:00
tsearch Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
utils Add views and functions to monitor hot standby query conflicts 2011-01-03 12:46:03 +01:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
Makefile Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
common.mk Improved parallel make support 2010-11-12 22:15:16 +02:00
nls.mk Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00