diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-08-01 19:16:47 +0000 | 
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-08-01 19:16:47 +0000 | 
| commit | 7354dbfa8c2f88dfea1a93960e04d1d7544d38c3 (patch) | |
| tree | 6fbe813a16f7718e27c28dbabb2eff6d688335e4 /src/include/access/gin.h | |
| parent | 538cb94db8ca507803d22a3c0ee1649822ec1c03 (diff) | |
Fix an additional set of problems in GIN's handling of lossy page pointers.
Although the key-combining code claimed to work correctly if its input
contained both lossy and exact pointers for a single page in a single TID
stream, in fact this did not work, and could not work without pretty
fundamental redesign.  Modify keyGetItem so that it will not return such a
stream, by handling lossy-pointer cases a bit more explicitly than we did
before.
Per followup investigation of a gripe from Artur Dabrowski.
An example of a query that failed given his data set is
select count(*) from search_tab where
(to_tsvector('german', keywords ) @@ to_tsquery('german', 'ee:* | dd:*')) and
(to_tsvector('german', keywords ) @@ to_tsquery('german', 'aa:*'));
Back-patch to 8.4 where the lossy pointer code was introduced.
Diffstat (limited to 'src/include/access/gin.h')
| -rw-r--r-- | src/include/access/gin.h | 13 | 
1 files changed, 11 insertions, 2 deletions
diff --git a/src/include/access/gin.h b/src/include/access/gin.h index 07eb3733cc0..f87dc8ebae1 100644 --- a/src/include/access/gin.h +++ b/src/include/access/gin.h @@ -4,7 +4,7 @@   *   *	Copyright (c) 2006-2010, PostgreSQL Global Development Group   * - *	$PostgreSQL: pgsql/src/include/access/gin.h,v 1.38.4.2 2010/08/01 02:12:51 tgl Exp $ + *	$PostgreSQL: pgsql/src/include/access/gin.h,v 1.38.4.3 2010/08/01 19:16:47 tgl Exp $   *--------------------------------------------------------------------------   */  #ifndef GIN_H @@ -107,13 +107,22 @@ typedef struct GinMetaPageData   * We use our own ItemPointerGet(BlockNumber|GetOffsetNumber)   * to avoid Asserts, since sometimes the ip_posid isn't "valid"   */ -  #define GinItemPointerGetBlockNumber(pointer) \  	BlockIdGetBlockNumber(&(pointer)->ip_blkid)  #define GinItemPointerGetOffsetNumber(pointer) \  	((pointer)->ip_posid) +/* + * Special-case item pointer values needed by the GIN search logic. + *	MIN: sorts less than any valid item pointer + *	MAX: sorts greater than any valid item pointer + *	LOSSY PAGE: indicates a whole heap page, sorts after normal item + *				pointers for that page + * Note that these are all distinguishable from an "invalid" item pointer + * (which is InvalidBlockNumber/0) as well as from all normal item + * pointers (which have item numbers in the range 1..MaxHeapTuplesPerPage). + */  #define ItemPointerSetMin(p)  \  	ItemPointerSet((p), (BlockNumber)0, (OffsetNumber)0)  #define ItemPointerIsMin(p)  \  | 
