#define RELATION_CHECKS \
( \
AssertMacro(RelationIsValid(indexRelation)), \
- AssertMacro(PointerIsValid(indexRelation->rd_amroutine)), \
+ AssertMacro(PointerIsValid(indexRelation->rd_indam)), \
AssertMacro(!ReindexIsProcessingIndex(RelationGetRelid(indexRelation))) \
)
( \
AssertMacro(IndexScanIsValid(scan)), \
AssertMacro(RelationIsValid(scan->indexRelation)), \
- AssertMacro(PointerIsValid(scan->indexRelation->rd_amroutine)) \
+ AssertMacro(PointerIsValid(scan->indexRelation->rd_indam)) \
)
#define CHECK_REL_PROCEDURE(pname) \
do { \
- if (indexRelation->rd_amroutine->pname == NULL) \
+ if (indexRelation->rd_indam->pname == NULL) \
elog(ERROR, "function %s is not defined for index %s", \
CppAsString(pname), RelationGetRelationName(indexRelation)); \
} while(0)
#define CHECK_SCAN_PROCEDURE(pname) \
do { \
- if (scan->indexRelation->rd_amroutine->pname == NULL) \
+ if (scan->indexRelation->rd_indam->pname == NULL) \
elog(ERROR, "function %s is not defined for index %s", \
CppAsString(pname), RelationGetRelationName(scan->indexRelation)); \
} while(0)
RELATION_CHECKS;
CHECK_REL_PROCEDURE(aminsert);
- if (!(indexRelation->rd_amroutine->ampredlocks))
+ if (!(indexRelation->rd_indam->ampredlocks))
CheckForSerializableConflictIn(indexRelation,
(HeapTuple) NULL,
InvalidBuffer);
- return indexRelation->rd_amroutine->aminsert(indexRelation, values, isnull,
- heap_t_ctid, heapRelation,
- checkUnique, indexInfo);
+ return indexRelation->rd_indam->aminsert(indexRelation, values, isnull,
+ heap_t_ctid, heapRelation,
+ checkUnique, indexInfo);
}
/*
RELATION_CHECKS;
CHECK_REL_PROCEDURE(ambeginscan);
- if (!(indexRelation->rd_amroutine->ampredlocks))
+ if (!(indexRelation->rd_indam->ampredlocks))
PredicateLockRelation(indexRelation, snapshot);
/*
/*
* Tell the AM to open a scan.
*/
- scan = indexRelation->rd_amroutine->ambeginscan(indexRelation, nkeys,
- norderbys);
+ scan = indexRelation->rd_indam->ambeginscan(indexRelation, nkeys,
+ norderbys);
/* Initialize information for parallel scan. */
scan->parallel_scan = pscan;
scan->xs_temp_snap = temp_snap;
scan->kill_prior_tuple = false; /* for safety */
- scan->indexRelation->rd_amroutine->amrescan(scan, keys, nkeys,
- orderbys, norderbys);
+ scan->indexRelation->rd_indam->amrescan(scan, keys, nkeys,
+ orderbys, norderbys);
}
/* ----------------
}
/* End the AM's scan */
- scan->indexRelation->rd_amroutine->amendscan(scan);
+ scan->indexRelation->rd_indam->amendscan(scan);
/* Release index refcount acquired by index_beginscan */
RelationDecrementReferenceCount(scan->indexRelation);
SCAN_CHECKS;
CHECK_SCAN_PROCEDURE(ammarkpos);
- scan->indexRelation->rd_amroutine->ammarkpos(scan);
+ scan->indexRelation->rd_indam->ammarkpos(scan);
}
/* ----------------
scan->kill_prior_tuple = false; /* for safety */
- scan->indexRelation->rd_amroutine->amrestrpos(scan);
+ scan->indexRelation->rd_indam->amrestrpos(scan);
}
/*
* AM-specific data needed. (It's hard to believe that could work, but
* it's easy enough to cater to it here.)
*/
- if (indexRelation->rd_amroutine->amestimateparallelscan != NULL)
+ if (indexRelation->rd_indam->amestimateparallelscan != NULL)
nbytes = add_size(nbytes,
- indexRelation->rd_amroutine->amestimateparallelscan());
+ indexRelation->rd_indam->amestimateparallelscan());
return nbytes;
}
SerializeSnapshot(snapshot, target->ps_snapshot_data);
/* aminitparallelscan is optional; assume no-op if not provided by AM */
- if (indexRelation->rd_amroutine->aminitparallelscan != NULL)
+ if (indexRelation->rd_indam->aminitparallelscan != NULL)
{
void *amtarget;
amtarget = OffsetToPointer(target, offset);
- indexRelation->rd_amroutine->aminitparallelscan(amtarget);
+ indexRelation->rd_indam->aminitparallelscan(amtarget);
}
}
SCAN_CHECKS;
/* amparallelrescan is optional; assume no-op if not provided by AM */
- if (scan->indexRelation->rd_amroutine->amparallelrescan != NULL)
- scan->indexRelation->rd_amroutine->amparallelrescan(scan);
+ if (scan->indexRelation->rd_indam->amparallelrescan != NULL)
+ scan->indexRelation->rd_indam->amparallelrescan(scan);
}
/*
* scan->xs_recheck and possibly scan->xs_itup/scan->xs_hitup, though we
* pay no attention to those fields here.
*/
- found = scan->indexRelation->rd_amroutine->amgettuple(scan, direction);
+ found = scan->indexRelation->rd_indam->amgettuple(scan, direction);
/* Reset kill flag immediately for safety */
scan->kill_prior_tuple = false;
/*
* have the am's getbitmap proc do all the work.
*/
- ntids = scan->indexRelation->rd_amroutine->amgetbitmap(scan, bitmap);
+ ntids = scan->indexRelation->rd_indam->amgetbitmap(scan, bitmap);
pgstat_count_index_tuples(scan->indexRelation, ntids);
RELATION_CHECKS;
CHECK_REL_PROCEDURE(ambulkdelete);
- return indexRelation->rd_amroutine->ambulkdelete(info, stats,
- callback, callback_state);
+ return indexRelation->rd_indam->ambulkdelete(info, stats,
+ callback, callback_state);
}
/* ----------------
RELATION_CHECKS;
CHECK_REL_PROCEDURE(amvacuumcleanup);
- return indexRelation->rd_amroutine->amvacuumcleanup(info, stats);
+ return indexRelation->rd_indam->amvacuumcleanup(info, stats);
}
/* ----------------
RELATION_CHECKS;
/* amcanreturn is optional; assume false if not provided by AM */
- if (indexRelation->rd_amroutine->amcanreturn == NULL)
+ if (indexRelation->rd_indam->amcanreturn == NULL)
return false;
- return indexRelation->rd_amroutine->amcanreturn(indexRelation, attno);
+ return indexRelation->rd_indam->amcanreturn(indexRelation, attno);
}
/* ----------------
int nproc;
int procindex;
- nproc = irel->rd_amroutine->amsupport;
+ nproc = irel->rd_indam->amsupport;
Assert(procnum > 0 && procnum <= (uint16) nproc);
int nproc;
int procindex;
- nproc = irel->rd_amroutine->amsupport;
+ nproc = irel->rd_indam->amsupport;
Assert(procnum > 0 && procnum <= (uint16) nproc);
*
* tuple is the real pg_class tuple (not rd_rel!) for relation
*
- * Note: rd_rel and (if an index) rd_amroutine must be valid already
+ * Note: rd_rel and (if an index) rd_indam must be valid already
*/
static void
RelationParseRelOptions(Relation relation, HeapTuple tuple)
break;
case RELKIND_INDEX:
case RELKIND_PARTITIONED_INDEX:
- amoptsfn = relation->rd_amroutine->amoptions;
+ amoptsfn = relation->rd_indam->amoptions;
break;
default:
return;
cached = (IndexAmRoutine *) MemoryContextAlloc(relation->rd_indexcxt,
sizeof(IndexAmRoutine));
memcpy(cached, tmp, sizeof(IndexAmRoutine));
- relation->rd_amroutine = cached;
+ relation->rd_indam = cached;
pfree(tmp);
}
relation->rd_opcintype = (Oid *)
MemoryContextAllocZero(indexcxt, indnkeyatts * sizeof(Oid));
- amsupport = relation->rd_amroutine->amsupport;
+ amsupport = relation->rd_indam->amsupport;
if (amsupport > 0)
{
int nsupport = indnatts * amsupport;
rel->rd_indoption = indoption;
/* set up zeroed fmgr-info vector */
- nsupport = relform->relnatts * rel->rd_amroutine->amsupport;
+ nsupport = relform->relnatts * rel->rd_indam->amsupport;
rel->rd_supportinfo = (FmgrInfo *)
MemoryContextAllocZero(indexcxt, nsupport * sizeof(FmgrInfo));
}
Assert(rel->rd_index == NULL);
Assert(rel->rd_indextuple == NULL);
Assert(rel->rd_indexcxt == NULL);
- Assert(rel->rd_amroutine == NULL);
+ Assert(rel->rd_indam == NULL);
Assert(rel->rd_opfamily == NULL);
Assert(rel->rd_opcintype == NULL);
Assert(rel->rd_support == NULL);
/* next, write the vector of support procedure OIDs */
write_item(rel->rd_support,
- relform->relnatts * (rel->rd_amroutine->amsupport * sizeof(RegProcedure)),
+ relform->relnatts * (rel->rd_indam->amsupport * sizeof(RegProcedure)),
fp);
/* next, write the vector of collation OIDs */