MCPcopy Create free account
hub / github.com/apache/cloudberry / GetTableAmRoutineByAmId

Function GetTableAmRoutineByAmId

src/backend/access/table/tableamapi.c:119–144  ·  view source on GitHub ↗

* GetTableAmRoutineByAmId - look up the handler of the table access method * with the given OID, and get its TableAmRoutine struct. * * If the given OID isn't a valid index access method, throws error. */

Source from the content-addressed store, hash-verified

117 * If the given OID isn't a valid index access method, throws error.
118 */
119const TableAmRoutine *
120GetTableAmRoutineByAmId(Oid amoid)
121{
122 HeapTuple tuple;
123 Form_pg_am amform;
124 regproc amhandler;
125
126 if (amoid == HEAP_TABLE_AM_OID)
127 return GetHeapamTableAmRoutine();
128
129 tuple = SearchSysCache1(AMOID, ObjectIdGetDatum(amoid));
130 if (!HeapTupleIsValid(tuple))
131 ereport(ERROR, (errmsg("cache lookup failed for access method %u", amoid)));
132
133 amform = (Form_pg_am) GETSTRUCT(tuple);
134 if (amform->amtype != AMTYPE_TABLE)
135 ereport(ERROR,
136 (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
137 errmsg("access method \"%s\" is not of type TABLE",
138 NameStr(amform->amname))));
139
140 amhandler = amform->amhandler;
141 ReleaseSysCache(tuple);
142
143 return GetTableAmRoutine(amhandler);
144}
145
146/* check_hook: validate new default_table_access_method */
147bool

Callers 8

swap_relation_filesFunction · 0.85
DefineRelationFunction · 0.85
ATExecAddColumnFunction · 0.85
ATExecSetRelOptionsFunction · 0.85
extract_autovac_optsFunction · 0.85
table_reloptions_amFunction · 0.85

Calls 7

GetHeapamTableAmRoutineFunction · 0.85
SearchSysCache1Function · 0.85
ObjectIdGetDatumFunction · 0.85
ReleaseSysCacheFunction · 0.85
GetTableAmRoutineFunction · 0.85
errmsgFunction · 0.50
errcodeFunction · 0.50

Tested by

no test coverage detected