50 bool nulls[Natts_pg_am];
59 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
60 errmsg(
"permission denied to create access method \"%s\"",
62 errhint(
"Must be superuser to create an access method.")));
71 errmsg(
"access method \"%s\" already exists",
84 memset(nulls,
false,
sizeof(nulls));
88 values[Anum_pg_am_amname - 1] =
98 myself.
classId = AccessMethodRelationId;
103 referenced.
classId = ProcedureRelationId;
139 if (amtype !=
'\0' &&
140 amform->amtype != amtype)
142 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
143 errmsg(
"access method \"%s\" is not of type %s",
153 (
errcode(ERRCODE_UNDEFINED_OBJECT),
154 errmsg(
"access method \"%s\" does not exist", amname)));
222 elog(
ERROR,
"invalid access method type '%c'", amtype);
237 Oid funcargtypes[1] = {INTERNALOID};
240 if (handler_name ==
NIL)
242 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
243 errmsg(
"handler function is not specified")));
246 handlerOid =
LookupFuncName(handler_name, 1, funcargtypes,
false);
252 expectedType = INDEX_AM_HANDLEROID;
255 expectedType = TABLE_AM_HANDLEROID;
258 elog(
ERROR,
"unrecognized access method type \"%c\"", amtype);
263 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
264 errmsg(
"function %s must return type %s",
ObjectAddress CreateAccessMethod(CreateAmStmt *stmt)
Oid get_table_am_oid(const char *amname, bool missing_ok)
Oid get_index_am_oid(const char *amname, bool missing_ok)
static const char * get_am_type_string(char amtype)
char * get_am_name(Oid amOid)
static Oid get_am_type_oid(const char *amname, char amtype, bool missing_ok)
Oid get_am_oid(const char *amname, bool missing_ok)
static Oid lookup_am_handler_func(List *handler_name, char amtype)
static Datum values[MAXATTR]
#define OidIsValid(objectId)
Oid GetNewOidWithIndex(Relation relation, Oid indexId, AttrNumber oidcolumn)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define DirectFunctionCall1(func, arg1)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
void heap_freetuple(HeapTuple htup)
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *tuple)
void CatalogTupleInsert(Relation heapRel, HeapTuple tup)
char * get_func_name(Oid funcid)
Oid get_func_rettype(Oid funcid)
char * pstrdup(const char *in)
Datum namein(PG_FUNCTION_ARGS)
#define InvokeObjectPostCreateHook(classId, objectId, subId)
Oid LookupFuncName(List *funcname, int nargs, const Oid *argtypes, bool missing_ok)
FormData_pg_am * Form_pg_am
void recordDependencyOn(const ObjectAddress *depender, const ObjectAddress *referenced, DependencyType behavior)
void recordDependencyOnCurrentExtension(const ObjectAddress *object, bool isReplace)
static Datum ObjectIdGetDatum(Oid X)
static Datum CStringGetDatum(const char *X)
static Datum CharGetDatum(char X)
#define RelationGetDescr(relation)
#define ERRCODE_DUPLICATE_OBJECT
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
#define GetSysCacheOid1(cacheId, oidcol, key1)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)