97 state->
oneCol = (origTupdesc->
natts == 1) ?
true :
false;
100 for (i = 0; i < origTupdesc->
natts; i++)
138 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
139 errmsg(
"could not identify a comparison function for type %s",
175 elog(
ERROR,
"missing GIN support function (%d or %d) for attribute %d of index \"%s\"",
394 if (categorya != categoryb)
395 return (categorya < categoryb) ? -1 : 1;
416 if (attnuma != attnumb)
417 return (attnuma < attnumb) ? -1 : 1;
500 entries[0] = (
Datum) 0;
518 if (entries == NULL || *nentries <= 0)
522 entries[0] = (
Datum) 0;
532 if (nullFlags == NULL)
533 nullFlags = (
bool *)
palloc0(*nentries *
sizeof(
bool));
548 for (i = 0; i < *nentries; i++)
565 entries[0] = keydata[0].
datum;
566 nullFlags[0] = keydata[0].
isnull;
568 for (i = 1; i < *nentries; i++)
570 if (
cmpEntries(&keydata[i - 1], &keydata[i], &arg) != 0)
572 entries[j] = keydata[
i].
datum;
573 nullFlags[j] = keydata[
i].
isnull;
582 for (i = 0; i < *nentries; i++)
596 for (i = 0; i < *nentries; i++)
608 pendingListCleanupSize)}
ambeginscan_function ambeginscan
#define PG_RETURN_POINTER(x)
Buffer GinNewBuffer(Relation index)
IndexBulkDeleteResult * ginvacuumcleanup(IndexVacuumInfo *info, IndexBulkDeleteResult *stats)
IndexScanDesc ginbeginscan(Relation rel, int nkeys, int norderbys)
int64 gingetbitmap(IndexScanDesc scan, TIDBitmap *tbm)
void ginendscan(IndexScanDesc scan)
Oid supportCollation[INDEX_MAX_KEYS]
ambulkdelete_function ambulkdelete
void ginrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys, ScanKey orderbys, int norderbys)
void GinInitMetabuffer(Buffer b)
#define GinPageIsRecyclable(page)
FmgrInfo * index_getprocinfo(Relation irel, AttrNumber attnum, uint16 procnum)
#define GIN_EXTRACTQUERY_PROC
amgettuple_function amgettuple
TupleDesc CreateTemplateTupleDesc(int natts)
void gincostestimate(PlannerInfo *root, IndexPath *path, double loop_count, Cost *indexStartupCost, Cost *indexTotalCost, Selectivity *indexSelectivity, double *indexCorrelation, double *indexPages)
#define RelationGetDescr(relation)
void GinInitPage(Page page, uint32 f, Size pageSize)
#define DatumGetUInt16(X)
amproperty_function amproperty
void MarkBufferDirty(Buffer buffer)
void XLogRegisterBuffer(uint8 block_id, Buffer buffer, uint8 flags)
#define PointerGetDatum(X)
#define TupleDescAttr(tupdesc, i)
#define GinGetNullCategory(itup, ginstate)
#define RELATION_IS_LOCAL(relation)
amparallelrescan_function amparallelrescan
#define END_CRIT_SECTION()
bool canPartialMatch[INDEX_MAX_KEYS]
#define START_CRIT_SECTION()
int ginCompareEntries(GinState *ginstate, OffsetNumber attnum, Datum a, GinNullCategory categorya, Datum b, GinNullCategory categoryb)
int ginCompareAttEntries(GinState *ginstate, OffsetNumber attnuma, Datum a, GinNullCategory categorya, OffsetNumber attnumb, Datum b, GinNullCategory categoryb)
int errcode(int sqlerrcode)
#define MemSet(start, val, len)
FmgrInfo consistentFn[INDEX_MAX_KEYS]
FmgrInfo extractValueFn[INDEX_MAX_KEYS]
#define GIN_TRICONSISTENT_PROC
void ReleaseBuffer(Buffer buffer)
#define GinPageGetOpaque(page)
#define GIN_METAPAGE_BLKNO
Datum ginhandler(PG_FUNCTION_ARGS)
void ginbuildempty(Relation index)
aminsert_function aminsert
#define GIN_COMPARE_PARTIAL_PROC
Datum FunctionCall2Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2)
#define OidIsValid(objectId)
amvalidate_function amvalidate
void * build_reloptions(Datum reloptions, bool validate, relopt_kind kind, Size relopt_struct_size, const relopt_parse_elt *relopt_elems, int num_relopt_elems)
void pfree(void *pointer)
amgetbitmap_function amgetbitmap
void UnlockReleaseBuffer(Buffer buffer)
IndexBuildResult * ginbuild(Relation heap, Relation index, IndexInfo *indexInfo)
signed char GinNullCategory
amoptions_function amoptions
bool ginvalidate(Oid opclassoid)
#define XLOG_GIN_UPDATE_META_PAGE
void TupleDescInitEntryCollation(TupleDesc desc, AttrNumber attributeNumber, Oid collationid)
void fmgr_info_copy(FmgrInfo *dstinfo, FmgrInfo *srcinfo, MemoryContext destcxt)
amcostestimate_function amcostestimate
bool gininsert(Relation index, Datum *values, bool *isnull, ItemPointer ht_ctid, Relation heapRel, IndexUniqueCheck checkUnique, IndexInfo *indexInfo)
OffsetNumber gintuple_get_attrnum(GinState *ginstate, IndexTuple tuple)
amvacuumcleanup_function amvacuumcleanup
amendscan_function amendscan
FmgrInfo comparePartialFn[INDEX_MAX_KEYS]
#define FirstOffsetNumber
#define GIN_CONSISTENT_PROC
void initGinState(GinState *state, Relation index)
#define RelationGetRelationName(relation)
FormData_pg_attribute * Form_pg_attribute
FmgrInfo extractQueryFn[INDEX_MAX_KEYS]
MemoryContext CurrentMemoryContext
Datum gintuple_get_key(GinState *ginstate, IndexTuple tuple, GinNullCategory *category)
void TupleDescInitEntry(TupleDesc desc, AttrNumber attributeNumber, const char *attributeName, Oid oidtypeid, int32 typmod, int attdim)
#define BufferGetPage(buffer)
#define ereport(elevel, rest)
amrescan_function amrescan
bool ConditionalLockBuffer(Buffer buffer)
bytea * ginoptions(Datum reloptions, bool validate)
void qsort_arg(void *base, size_t nel, size_t elsize, qsort_arg_comparator cmp, void *arg)
void LockRelationForExtension(Relation relation, LOCKMODE lockmode)
void XLogRegisterData(char *data, int len)
BlockNumber nPendingPages
XLogRecPtr XLogInsert(RmgrId rmid, uint8 info)
void * palloc0(Size size)
void UnlockRelationForExtension(Relation relation, LOCKMODE lockmode)
void ginGetStats(Relation index, GinStatsData *stats)
TupleDesc tupdesc[INDEX_MAX_KEYS]
#define BufferGetPageSize(buffer)
void LockBuffer(Buffer buffer, int mode)
#define GIN_CAT_NULL_ITEM
TypeCacheEntry * lookup_type_cache(Oid type_id, int flags)
Datum FunctionCall3Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3)
BlockNumber GetFreeIndexPage(Relation rel)
PageHeaderData * PageHeader
#define GIN_EXTRACTVALUE_PROC
#define Assert(condition)
IndexBulkDeleteResult * ginbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats, IndexBulkDeleteCallback callback, void *callback_state)
Buffer ReadBuffer(Relation reln, BlockNumber blockNum)
#define OffsetNumberNext(offsetNumber)
#define GIN_CURRENT_VERSION
#define InvalidBlockNumber
void GinInitBuffer(Buffer b, uint32 f)
#define index_getattr(tup, attnum, tupleDesc, isnull)
ammarkpos_function ammarkpos
ambuildphasename_function ambuildphasename
#define RelationNeedsWAL(relation)
amestimateparallelscan_function amestimateparallelscan
#define DatumGetPointer(X)
void ginUpdateStats(Relation index, const GinStatsData *stats, bool is_build)
int errmsg(const char *fmt,...)
ambuildempty_function ambuildempty
#define TYPECACHE_CMP_PROC_FINFO
#define GinPageGetMeta(p)
FmgrInfo triConsistentFn[INDEX_MAX_KEYS]
#define GIN_CAT_EMPTY_ITEM
void XLogBeginInsert(void)
#define PageSetLSN(page, lsn)
amcanreturn_function amcanreturn
Datum * ginExtractEntries(GinState *ginstate, OffsetNumber attnum, Datum value, bool isNull, int32 *nentries, GinNullCategory **categories)
static int cmpEntries(const void *a, const void *b, void *arg)
#define offsetof(type, field)
aminitparallelscan_function aminitparallelscan
FmgrInfo compareFn[INDEX_MAX_KEYS]
amrestrpos_function amrestrpos
BlockNumber nPendingPages
void PageInit(Page page, Size pageSize, Size specialSize)
RegProcedure index_getprocid(Relation irel, AttrNumber attnum, uint16 procnum)