38{
39 const char *languageName =
stmt->plname;
42 inlineOid,
43 valOid;
49 bool nulls[Natts_pg_language];
50 bool replaces[Natts_pg_language];
55 bool is_update;
57 referenced;
59
60
61
62
65 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
66 errmsg(
"must be superuser to create custom procedural language")));
67
68
69
70
71
75 if (funcrettype != LANGUAGE_HANDLEROID)
77 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
78 errmsg(
"function %s must return type %s",
80
81
83 {
84 funcargtypes[0] = INTERNALOID;
86
87 }
88 else
90
91
92 if (
stmt->plvalidator)
93 {
94 funcargtypes[0] = OIDOID;
96
97 }
98 else
100
101
104
105
107 memset(nulls, false, sizeof(nulls));
108 memset(replaces, true, sizeof(replaces));
109
118 nulls[Anum_pg_language_lanacl - 1] = true;
119
120
122
124 {
126
127
131 errmsg(
"language \"%s\" already exists", languageName)));
132
133
134#ifdef NOT_USED
137 languageName);
138#endif
139
140
141
142
143
144 replaces[Anum_pg_language_oid - 1] = false;
145 replaces[Anum_pg_language_lanowner - 1] = false;
146 replaces[Anum_pg_language_lanacl - 1] = false;
147
148
151
152 langoid = oldform->oid;
154 is_update = true;
155 }
156 else
157 {
158
160 Anum_pg_language_oid);
164 is_update = false;
165 }
166
167
168
169
170
171
172
173 myself.
classId = LanguageRelationId;
176
177 if (is_update)
179
180
181 if (!is_update)
183 languageOwner);
184
185
187
189
190
193
194
196 {
199 }
200
201
203 {
206 }
207
210
211
213
215
216 return myself;
217}
void aclcheck_error(AclResult aclerr, ObjectType objtype, const char *objectname)
bool object_ownercheck(Oid classid, Oid objectid, Oid roleid)
static Datum values[MAXATTR]
#define Assert(condition)
#define OidIsValid(objectId)
Oid GetNewOidWithIndex(Relation relation, Oid indexId, AttrNumber oidcolumn)
void record_object_address_dependencies(const ObjectAddress *depender, ObjectAddresses *referenced, DependencyType behavior)
void add_exact_object_address(const ObjectAddress *object, ObjectAddresses *addrs)
ObjectAddresses * new_object_addresses(void)
void free_object_addresses(ObjectAddresses *addrs)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
HeapTuple heap_modify_tuple(HeapTuple tuple, TupleDesc tupleDesc, const Datum *replValues, const bool *replIsnull, const bool *doReplace)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
#define HeapTupleIsValid(tuple)
void CatalogTupleUpdate(Relation heapRel, ItemPointer otid, HeapTuple tup)
void CatalogTupleInsert(Relation heapRel, HeapTuple tup)
Oid get_func_rettype(Oid funcid)
void namestrcpy(Name name, const char *str)
char * NameListToString(const List *names)
#define InvokeObjectPostCreateHook(classId, objectId, subId)
#define ObjectAddressSet(addr, class_id, object_id)
Oid LookupFuncName(List *funcname, int nargs, const Oid *argtypes, bool missing_ok)
long deleteDependencyRecordsFor(Oid classId, Oid objectId, bool skipExtensionDeps)
void recordDependencyOnCurrentExtension(const ObjectAddress *object, bool isReplace)
FormData_pg_language * Form_pg_language
void recordDependencyOnOwner(Oid classId, Oid objectId, Oid owner)
static Datum PointerGetDatum(const void *X)
static Datum BoolGetDatum(bool X)
static Datum ObjectIdGetDatum(Oid X)
static Datum NameGetDatum(const NameData *X)
#define RelationGetDescr(relation)
#define ERRCODE_DUPLICATE_OBJECT
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)