41 "Gin scan temporary context",
44 "Gin scan key context",
61 bool isPartialMatch,
Pointer extra_data)
117 scanEntry->
list = NULL;
118 scanEntry->
nlist = 0;
146 int i = key->nentries++;
151 (
Datum) 0, queryCategory,
163 bool *partial_matches,
Pointer *extra_data)
169 key->nentries = nQueryValues;
170 key->nuserentries = nQueryValues;
177 key->queryValues = queryValues;
178 key->queryCategories = queryCategories;
179 key->extra_data = extra_data;
180 key->strategy = strategy;
181 key->searchMode = searchMode;
191 key->curItemMatches =
false;
192 key->recheckCurItem =
false;
193 key->isFinished =
false;
195 key->nadditional = 0;
196 key->requiredEntries = NULL;
197 key->additionalEntries = NULL;
202 for (
i = 0;
i < nQueryValues;
i++)
209 queryKey = queryValues[
i];
210 queryCategory = queryCategories[
i];
213 ? partial_matches[
i] :
false;
214 this_extra = (extra_data) ? extra_data[
i] : NULL;
217 strategy, searchMode,
218 queryKey, queryCategory,
219 isPartialMatch, this_extra);
241 if (so->
keys == NULL)
273 bool hasNullQuery =
false;
301 int32 nQueryValues = 0;
302 bool *partial_matches = NULL;
304 bool *nullFlags = NULL;
319 queryValues = (
Datum *)
346 if (queryValues == NULL || nQueryValues <= 0)
366 for (
j = 0;
j < nQueryValues;
j++)
379 queryValues, categories,
380 partial_matches, extra_data);
384 attrHasNormalScan[skey->
sk_attno - 1] =
true;
403 if (!attrHasNormalScan[key->attnum - 1])
405 key->excludeOnly =
false;
407 attrHasNormalScan[key->attnum - 1] =
true;
417 if (numExcludeOnly > 0)
424 Assert(numExcludeOnly < so->nkeys);
429 iExcludeOnly = so->
nkeys - numExcludeOnly;
434 if (key->excludeOnly)
462 NULL, NULL, NULL, NULL);
477 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
478 errmsg(
"old GIN indexes do not support whole-index scans nor searches for nulls"),
479 errhint(
"To fix this, do REINDEX INDEX \"%s\".",
492 ScanKey orderbys,
int norderbys)
#define InvalidBlockNumber
void ReleaseBuffer(Buffer buffer)
#define Assert(condition)
memcpy(sums, checksumBaseOffsets, sizeof(checksumBaseOffsets))
int errcode(int sqlerrcode)
int errhint(const char *fmt,...) pg_attribute_printf(1
#define ereport(elevel,...)
#define palloc_object(type)
#define repalloc_array(pointer, type, count)
#define palloc_array(type, count)
#define palloc0_array(type, count)
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
GinScanOpaqueData * GinScanOpaque
static int ginCompareEntries(GinState *ginstate, OffsetNumber attnum, Datum a, GinNullCategory categorya, Datum b, GinNullCategory categoryb)
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)
void MemoryContextReset(MemoryContext context)
void pfree(void *pointer)
void * palloc0(Size size)
MemoryContext CurrentMemoryContext
void MemoryContextDelete(MemoryContext context)
#define AllocSetContextCreate
#define ALLOCSET_DEFAULT_SIZES
#define InvalidOffsetNumber
#define FirstOffsetNumber
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
#define pgstat_count_index_scan(rel)
static Datum UInt16GetDatum(uint16 X)
static Pointer DatumGetPointer(Datum X)
#define PointerGetDatum(X)
#define RelationGetRelationName(relation)
TBMIterateResult matchResult
TBMPrivateIterator * matchIterator
GinNullCategory queryCategory
FmgrInfo extractQueryFn[INDEX_MAX_KEYS]
Oid supportCollation[INDEX_MAX_KEYS]
bool canPartialMatch[INDEX_MAX_KEYS]
struct ScanKeyData * keyData
struct IndexScanInstrumentation * instrument
StrategyNumber sk_strategy
void tbm_free(TIDBitmap *tbm)
void tbm_end_private_iterate(TBMPrivateIterator *iterator)