diff options
Diffstat (limited to 'src/backend/access/gin/ginget.c')
-rw-r--r-- | src/backend/access/gin/ginget.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/backend/access/gin/ginget.c b/src/backend/access/gin/ginget.c index 57d378a42f7..9d73142ee93 100644 --- a/src/backend/access/gin/ginget.c +++ b/src/backend/access/gin/ginget.c @@ -560,6 +560,10 @@ startScan(IndexScanDesc scan) } } + /* + * Now that we have the estimates for the entry frequencies, finish + * initializing the scan keys. + */ for (i = 0; i < so->nkeys; i++) startScanKey(ginstate, so, so->keys + i); } @@ -1763,7 +1767,6 @@ scanPendingInsert(IndexScanDesc scan, TIDBitmap *tbm, int64 *ntids) } -#define GinIsNewKey(s) ( ((GinScanOpaque) scan->opaque)->keys == NULL ) #define GinIsVoidRes(s) ( ((GinScanOpaque) scan->opaque)->isVoidRes ) Datum @@ -1771,6 +1774,7 @@ gingetbitmap(PG_FUNCTION_ARGS) { IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0); TIDBitmap *tbm = (TIDBitmap *) PG_GETARG_POINTER(1); + GinScanOpaque so = (GinScanOpaque) scan->opaque; int64 ntids; ItemPointerData iptr; bool recheck; @@ -1778,8 +1782,8 @@ gingetbitmap(PG_FUNCTION_ARGS) /* * Set up the scan keys, and check for unsatisfiable query. */ - if (GinIsNewKey(scan)) - ginNewScanKey(scan); + ginFreeScanKeys(so); /* there should be no keys yet, but just to be sure */ + ginNewScanKey(scan); if (GinIsVoidRes(scan)) PG_RETURN_INT64(0); |