PostgreSQL Source Code: src/backend/commands/amcmds.c Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
15
32
33
36
37
38
39
40
41
44{
49 Oid amhandler;
53
55
56
60 errmsg("permission denied to create access method \"%s\"",
61 stmt->amname),
62 errhint("Must be superuser to create an access method.")));
63
64
68 {
71 errmsg("access method \"%s\" already exists",
72 stmt->amname)));
73 }
74
75
76
77
79
80
81
82
84 memset(nulls, false, sizeof(nulls));
85
92
94
97
100 myself.objectSubId = 0;
101
102
106
108
110
112
114
116}
117
118
119
120
121
122
123
124
125
126
127
128static Oid
130{
133
136 {
138
139 if (amtype != '\0' &&
140 amform->amtype != amtype)
143 errmsg("access method \"%s\" is not of type %s",
146
149 }
150
154 errmsg("access method \"%s\" does not exist", amname)));
155 return oid;
156}
157
158
159
160
161
167
168
169
170
171
177
178
179
180
181
187
188
189
190
191char *
193{
195 char *result = NULL;
196
199 {
201
204 }
205 return result;
206}
207
208
209
210
211static const char *
213{
214 switch (amtype)
215 {
217 return "INDEX";
219 return "TABLE";
220 default:
221
222 elog(ERROR, "invalid access method type '%c'", amtype);
223 return NULL;
224 }
225}
226
227
228
229
230
231
232
233static Oid
235{
239
240 if (handler_name == NIL)
243 errmsg("handler function is not specified")));
244
245
247
248
249 switch (amtype)
250 {
253 break;
256 break;
257 default:
258 elog(ERROR, "unrecognized access method type \"%c\"", amtype);
259 }
260
264 errmsg("function %s must return type %s",
267
269}
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 errcode(int sqlerrcode)
int errhint(const char *fmt,...) pg_attribute_printf(1
#define ereport(elevel,...)
#define DirectFunctionCall1(func, arg1)
char * format_type_extended(Oid type_oid, int32 typemod, bits16 flags)
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)
END_CATALOG_STRUCT typedef 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(SysCacheIdentifier cacheId, Datum key1)
#define GetSysCacheOid1(cacheId, oidcol, key1)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)