40 "Gin scan temporary context",
43 "Gin scan key context",
60 bool isPartialMatch,
Pointer extra_data)
72 if (extra_data == NULL)
110 scanEntry->
list = NULL;
111 scanEntry->
nlist = 0;
140 int i =
key->nentries++;
145 (
Datum) 0, queryCategory,
157 bool *partial_matches,
Pointer *extra_data)
163 key->nentries = nQueryValues;
164 key->nuserentries = nQueryValues;
173 key->queryValues = queryValues;
174 key->queryCategories = queryCategories;
175 key->extra_data = extra_data;
176 key->strategy = strategy;
177 key->searchMode = searchMode;
187 key->curItemMatches =
false;
188 key->recheckCurItem =
false;
189 key->isFinished =
false;
191 key->nadditional = 0;
192 key->requiredEntries = NULL;
193 key->additionalEntries = NULL;
198 for (
i = 0;
i < nQueryValues;
i++)
205 queryKey = queryValues[
i];
206 queryCategory = queryCategories[
i];
209 ? partial_matches[
i] :
false;
210 this_extra = (extra_data) ? extra_data[
i] : NULL;
213 strategy, searchMode,
214 queryKey, queryCategory,
215 isPartialMatch, this_extra);
237 if (so->
keys == NULL)
268 bool hasNullQuery =
false;
285 so->totalentries = 0;
286 so->allocentries = 32;
290 so->isVoidRes =
false;
292 for (
i = 0;
i < scan->numberOfKeys;
i++)
296 int32 nQueryValues = 0;
297 bool *partial_matches = NULL;
299 bool *nullFlags = NULL;
309 so->isVoidRes =
true;
314 queryValues = (
Datum *)
316 so->ginstate.supportCollation[skey->
sk_attno - 1],
341 if (queryValues == NULL || nQueryValues <= 0)
345 so->isVoidRes =
true;
361 for (
j = 0;
j < nQueryValues;
j++)
374 queryValues, categories,
375 partial_matches, extra_data);
379 attrHasNormalScan[skey->
sk_attno - 1] =
true;
390 for (
i = 0;
i < so->nkeys;
i++)
397 if (!attrHasNormalScan[
key->attnum - 1])
399 key->excludeOnly =
false;
401 attrHasNormalScan[
key->attnum - 1] =
true;
409 if (so->nkeys == 0 && !so->isVoidRes)
415 NULL, NULL, NULL, NULL);
423 if (hasNullQuery && !so->isVoidRes)
430 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
431 errmsg(
"old GIN indexes do not support whole-index scans nor searches for nulls"),
432 errhint(
"To fix this, do REINDEX INDEX \"%s\".",
443 ScanKey orderbys,
int norderbys)
void ReleaseBuffer(Buffer buffer)
#define Assert(condition)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
Datum FunctionCall7Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7)
IndexScanDesc RelationGetIndexScan(Relation indexRelation, int nkeys, int norderbys)
#define GIN_SEARCH_MODE_ALL
#define GIN_SEARCH_MODE_EVERYTHING
#define GIN_SEARCH_MODE_DEFAULT
#define GIN_SEARCH_MODE_INCLUDE_EMPTY
struct GinScanKeyData GinScanKeyData
GinScanOpaqueData * GinScanOpaque
struct GinScanEntryData * GinScanEntry
struct GinScanKeyData * GinScanKey
#define GIN_CAT_EMPTY_ITEM
signed char GinNullCategory
#define ItemPointerSetMin(p)
#define GIN_CAT_EMPTY_QUERY
void ginInitConsistentFunction(GinState *ginstate, GinScanKey key)
IndexScanDesc ginbeginscan(Relation rel, int nkeys, int norderbys)
void ginFreeScanKeys(GinScanOpaque so)
static void ginFillScanKey(GinScanOpaque so, OffsetNumber attnum, StrategyNumber strategy, int32 searchMode, Datum query, uint32 nQueryValues, Datum *queryValues, GinNullCategory *queryCategories, bool *partial_matches, Pointer *extra_data)
void ginendscan(IndexScanDesc scan)
void ginNewScanKey(IndexScanDesc scan)
void ginrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys, ScanKey orderbys, int norderbys)
static void ginScanKeyAddHiddenEntry(GinScanOpaque so, GinScanKey key, GinNullCategory queryCategory)
static GinScanEntry ginFillScanEntry(GinScanOpaque so, OffsetNumber attnum, StrategyNumber strategy, int32 searchMode, Datum queryKey, GinNullCategory queryCategory, bool isPartialMatch, Pointer extra_data)
void ginGetStats(Relation index, GinStatsData *stats)
void initGinState(GinState *state, Relation index)
int ginCompareEntries(GinState *ginstate, OffsetNumber attnum, Datum a, GinNullCategory categorya, Datum b, GinNullCategory categoryb)
void MemoryContextReset(MemoryContext context)
void pfree(void *pointer)
void * palloc0(Size size)
MemoryContext CurrentMemoryContext
void * repalloc(void *pointer, Size size)
void MemoryContextDelete(MemoryContext context)
#define AllocSetContextCreate
#define ALLOCSET_DEFAULT_SIZES
#define InvalidOffsetNumber
#define FirstOffsetNumber
#define pgstat_count_index_scan(rel)
static Datum PointerGetDatum(const void *X)
static Datum UInt16GetDatum(uint16 X)
static Pointer DatumGetPointer(Datum X)
MemoryContextSwitchTo(old_ctx)
#define RelationGetRelationName(relation)
TBMIterateResult * matchResult
GinNullCategory queryCategory
TBMIterator * matchIterator
bool canPartialMatch[INDEX_MAX_KEYS]
struct ScanKeyData * keyData
StrategyNumber sk_strategy
void tbm_free(TIDBitmap *tbm)
void tbm_end_iterate(TBMIterator *iterator)