39 const char *languageName =
stmt->plname;
49 bool nulls[Natts_pg_language];
50 bool replaces[Natts_pg_language];
65 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
66 errmsg(
"must be superuser to create custom procedural language")));
75 if (funcrettype != LANGUAGE_HANDLEROID)
77 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
78 errmsg(
"function %s must return type %s",
84 funcargtypes[0] = INTERNALOID;
92 if (
stmt->plvalidator)
94 funcargtypes[0] = OIDOID;
107 memset(nulls,
false,
sizeof(nulls));
108 memset(replaces,
true,
sizeof(replaces));
118 nulls[Anum_pg_language_lanacl - 1] =
true;
131 errmsg(
"language \"%s\" already exists", languageName)));
144 replaces[Anum_pg_language_oid - 1] =
false;
145 replaces[Anum_pg_language_lanowner - 1] =
false;
146 replaces[Anum_pg_language_lanacl - 1] =
false;
152 langoid = oldform->oid;
160 Anum_pg_language_oid);
173 myself.
classId = LanguageRelationId;
234 (
errcode(ERRCODE_UNDEFINED_OBJECT),
235 errmsg(
"language \"%s\" does not exist", langname)));
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)
ObjectAddresses * new_object_addresses(void)
void add_exact_object_address(const ObjectAddress *object, ObjectAddresses *addrs)
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)
static Datum CStringGetDatum(const char *X)
Oid get_language_oid(const char *langname, bool missing_ok)
ObjectAddress CreateProceduralLanguage(CreatePLangStmt *stmt)
#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)