PostgreSQL Source Code: src/include/access/amapi.h File Reference (original) (raw)

Go to the source code of this file.

Typedefs
typedef enum IndexAMProperty IndexAMProperty
typedef struct OpFamilyMember OpFamilyMember
typedef CompareType(* amtranslate_strategy_function) (StrategyNumber strategy, Oid opfamily)
typedef StrategyNumber(* amtranslate_cmptype_function) (CompareType cmptype, Oid opfamily)
typedef IndexBuildResult *(* ambuild_function) (Relation heapRelation, Relation indexRelation, struct IndexInfo *indexInfo)
typedef void(* ambuildempty_function) (Relation indexRelation)
typedef bool(* aminsert_function) (Relation indexRelation, Datum *values, bool *isnull, ItemPointer heap_tid, Relation heapRelation, IndexUniqueCheck checkUnique, bool indexUnchanged, struct IndexInfo *indexInfo)
typedef void(* aminsertcleanup_function) (Relation indexRelation, struct IndexInfo *indexInfo)
typedef IndexBulkDeleteResult *(* ambulkdelete_function) (IndexVacuumInfo *info, IndexBulkDeleteResult *stats, IndexBulkDeleteCallback callback, void *callback_state)
typedef IndexBulkDeleteResult *(* amvacuumcleanup_function) (IndexVacuumInfo *info, IndexBulkDeleteResult *stats)
typedef bool(* amcanreturn_function) (Relation indexRelation, int attno)
typedef void(* amcostestimate_function) (struct PlannerInfo *root, struct IndexPath *path, double loop_count, Cost *indexStartupCost, Cost *indexTotalCost, Selectivity *indexSelectivity, double *indexCorrelation, double *indexPages)
typedef int(* amgettreeheight_function) (Relation rel)
typedef bytea *(* amoptions_function) (Datum reloptions, bool validate)
typedef bool(* amproperty_function) (Oid index_oid, int attno, IndexAMProperty prop, const char *propname, bool *res, bool *isnull)
typedef char *(* ambuildphasename_function) (int64 phasenum)
typedef bool(* amvalidate_function) (Oid opclassoid)
typedef void(* amadjustmembers_function) (Oid opfamilyoid, Oid opclassoid, List *operators, List *functions)
typedef IndexScanDesc(* ambeginscan_function) (Relation indexRelation, int nkeys, int norderbys)
typedef void(* amrescan_function) (IndexScanDesc scan, ScanKey keys, int nkeys, ScanKey orderbys, int norderbys)
typedef bool(* amgettuple_function) (IndexScanDesc scan, ScanDirection direction)
typedef int64(* amgetbitmap_function) (IndexScanDesc scan, TIDBitmap *tbm)
typedef void(* amendscan_function) (IndexScanDesc scan)
typedef void(* ammarkpos_function) (IndexScanDesc scan)
typedef void(* amrestrpos_function) (IndexScanDesc scan)
typedef Size(* amestimateparallelscan_function) (Relation indexRelation, int nkeys, int norderbys)
typedef void(* aminitparallelscan_function) (void *target)
typedef void(* amparallelrescan_function) (IndexScanDesc scan)
typedef struct IndexAmRoutine IndexAmRoutine
Enumerations
enum IndexAMProperty { AMPROP_UNKNOWN = 0 , AMPROP_ASC, AMPROP_DESC, AMPROP_NULLS_FIRST, AMPROP_NULLS_LAST, AMPROP_ORDERABLE, AMPROP_DISTANCE_ORDERABLE, AMPROP_RETURNABLE, AMPROP_SEARCH_ARRAY, AMPROP_SEARCH_NULLS, AMPROP_CLUSTERABLE, AMPROP_INDEX_SCAN, AMPROP_BITMAP_SCAN, AMPROP_BACKWARD_SCAN, AMPROP_CAN_ORDER, AMPROP_CAN_UNIQUE, AMPROP_CAN_MULTI_COL, AMPROP_CAN_EXCLUDE, AMPROP_CAN_INCLUDE }
Functions
IndexAmRoutine * GetIndexAmRoutine (Oid amhandler)
IndexAmRoutine * GetIndexAmRoutineByAmId (Oid amoid, bool noerror)
CompareType IndexAmTranslateStrategy (StrategyNumber strategy, Oid amoid, Oid opfamily, bool missing_ok)
StrategyNumber IndexAmTranslateCompareType (CompareType cmptype, Oid amoid, Oid opfamily, bool missing_ok)

amadjustmembers_function

ambeginscan_function

ambuild_function

ambuildempty_function

typedef void(* ambuildempty_function) (Relation indexRelation)

ambuildphasename_function

typedef char *(* ambuildphasename_function) (int64 phasenum)

ambulkdelete_function

amcanreturn_function

typedef bool(* amcanreturn_function) (Relation indexRelation, int attno)

amcostestimate_function

typedef void(* amcostestimate_function) (struct PlannerInfo *root, struct IndexPath *path, double loop_count, Cost *indexStartupCost, Cost *indexTotalCost, Selectivity *indexSelectivity, double *indexCorrelation, double *indexPages)

amendscan_function

amestimateparallelscan_function

typedef Size(* amestimateparallelscan_function) (Relation indexRelation, int nkeys, int norderbys)

amgetbitmap_function

amgettreeheight_function

typedef int(* amgettreeheight_function) (Relation rel)

amgettuple_function

aminitparallelscan_function

typedef void(* aminitparallelscan_function) (void *target)

aminsert_function

aminsertcleanup_function

typedef void(* aminsertcleanup_function) (Relation indexRelation, struct IndexInfo *indexInfo)

ammarkpos_function

amoptions_function

amparallelrescan_function

amproperty_function

typedef bool(* amproperty_function) (Oid index_oid, int attno, IndexAMProperty prop, const char *propname, bool *res, bool *isnull)

amrescan_function

amrestrpos_function

amtranslate_cmptype_function

amtranslate_strategy_function

amvacuumcleanup_function

amvalidate_function

typedef bool(* amvalidate_function) (Oid opclassoid)

IndexAMProperty

IndexAmRoutine

OpFamilyMember

IndexAMProperty

Enumerator
AMPROP_UNKNOWN
AMPROP_ASC
AMPROP_DESC
AMPROP_NULLS_FIRST
AMPROP_NULLS_LAST
AMPROP_ORDERABLE
AMPROP_DISTANCE_ORDERABLE
AMPROP_RETURNABLE
AMPROP_SEARCH_ARRAY
AMPROP_SEARCH_NULLS
AMPROP_CLUSTERABLE
AMPROP_INDEX_SCAN
AMPROP_BITMAP_SCAN
AMPROP_BACKWARD_SCAN
AMPROP_CAN_ORDER
AMPROP_CAN_UNIQUE
AMPROP_CAN_MULTI_COL
AMPROP_CAN_EXCLUDE
AMPROP_CAN_INCLUDE

Definition at line 36 of file amapi.h.

GetIndexAmRoutine()

Definition at line 33 of file amapi.c.

34{

37

40

42 elog(ERROR, "index access method handler function %u did not return an IndexAmRoutine struct",

43 amhandler);

44

45 return routine;

46}

#define OidFunctionCall0(functionId)

#define IsA(nodeptr, _type_)

static Pointer DatumGetPointer(Datum X)

References DatumGetPointer(), elog, ERROR, IsA, and OidFunctionCall0.

Referenced by CheckIndexCompatible(), DefineIndex(), GetIndexAmRoutineByAmId(), InitIndexAmRoutine(), and pg_get_indexdef_worker().

GetIndexAmRoutineByAmId()

Definition at line 56 of file amapi.c.

57{

61

62

65 {

66 if (noerror)

67 return NULL;

68 elog(ERROR, "cache lookup failed for access method %u",

69 amoid);

70 }

72

73

74 if (amform->amtype != AMTYPE_INDEX)

75 {

76 if (noerror)

77 {

79 return NULL;

80 }

82 (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),

83 errmsg("access method \"%s\" is not of type %s",

84 NameStr(amform->amname), "INDEX")));

85 }

86

87 amhandler = amform->amhandler;

88

89

91 {

92 if (noerror)

93 {

95 return NULL;

96 }

98 (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),

99 errmsg("index access method \"%s\" does not have a handler",

100 NameStr(amform->amname))));

101 }

102

104

105

107}

IndexAmRoutine * GetIndexAmRoutine(Oid amhandler)

#define RegProcedureIsValid(p)

int errcode(int sqlerrcode)

int errmsg(const char *fmt,...)

#define ereport(elevel,...)

#define HeapTupleIsValid(tuple)

static void * GETSTRUCT(const HeapTupleData *tuple)

FormData_pg_am * Form_pg_am

static Datum ObjectIdGetDatum(Oid X)

void ReleaseSysCache(HeapTuple tuple)

HeapTuple SearchSysCache1(int cacheId, Datum key1)

References elog, ereport, errcode(), errmsg(), ERROR, GetIndexAmRoutine(), GETSTRUCT(), HeapTupleIsValid, NameStr, ObjectIdGetDatum(), RegProcedureIsValid, ReleaseSysCache(), and SearchSysCache1().

Referenced by AlterOpFamily(), AlterOpFamilyAdd(), amvalidate(), assignOperTypes(), assignProcTypes(), comparison_ops_are_compatible(), ConstructTupleDescriptor(), DefineOpClass(), equality_ops_are_compatible(), get_op_index_interpretation(), get_opmethod_canorder(), indexam_property(), IndexAmTranslateCompareType(), IndexAmTranslateStrategy(), IndexSupportsBackwardScan(), IsIndexUsableForReplicaIdentityFull(), and pg_indexam_progress_phasename().

IndexAmTranslateCompareType()

Definition at line 148 of file amapi.c.

149{

152

153

154 if (amoid == BTREE_AM_OID &&

157

161 else

163

165 elog(ERROR, "could not translate compare type %u for index AM %u", cmptype, amoid);

166

167 return result;

168}

IndexAmRoutine * GetIndexAmRoutineByAmId(Oid amoid, bool noerror)

amtranslate_cmptype_function amtranslatecmptype

References IndexAmRoutine::amtranslatecmptype, COMPARE_GT, COMPARE_INVALID, elog, ERROR, GetIndexAmRoutineByAmId(), and InvalidStrategy.

Referenced by ATAddForeignKeyConstraint(), build_replindex_scan_key(), BuildSpeculativeIndexInfo(), get_opfamily_member_for_cmptype(), GetOperatorFromCompareType(), IsIndexUsableForReplicaIdentityFull(), and mergejoinscansel().

IndexAmTranslateStrategy()

Definition at line 118 of file amapi.c.

119{

122

123

124 if (amoid == BTREE_AM_OID &&

127

131 else

133

135 elog(ERROR, "could not translate strategy number %d for index AM %u", strategy, amoid);

136

137 return result;

138}

#define BTMaxStrategyNumber

amtranslate_strategy_function amtranslatestrategy

References IndexAmRoutine::amtranslatestrategy, BTMaxStrategyNumber, COMPARE_INVALID, elog, ERROR, GetIndexAmRoutineByAmId(), and InvalidStrategy.

Referenced by get_actual_variable_range(), get_mergejoin_opfamilies(), get_op_index_interpretation(), get_ordering_op_for_equality_op(), get_ordering_op_properties(), mergejoinscansel(), and MJExamineQuals().