mirror of
https://github.com/postgres/postgres.git
synced 2025-08-24 09:27:52 +03:00
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.
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* Copyright (c) 2006-2010, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/access/gin.h,v 1.40 2010/08/01 02:12:42 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/include/access/gin.h,v 1.41 2010/08/01 19:16:39 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) \
|
||||
|
Reference in New Issue
Block a user