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