63 #include "utils/fmgroids.h"
84 Oid *prorettype_p,
bool *returnsSet_p)
98 (
errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
99 errmsg(
"SQL function cannot return shell type %s",
103 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
104 errmsg(
"return type %s is only a shell",
127 (
errcode(ERRCODE_UNDEFINED_OBJECT),
128 errmsg(
"type \"%s\" does not exist", typnam)));
133 (
errcode(ERRCODE_SYNTAX_ERROR),
134 errmsg(
"type modifier cannot be specified for shell type \"%s\"",
139 (
errcode(ERRCODE_UNDEFINED_OBJECT),
140 errmsg(
"type \"%s\" is not yet defined", typnam),
141 errdetail(
"Creating a shell type definition.")));
158 *prorettype_p = rettype;
159 *returnsSet_p = returnType->
setof;
183 const char *queryString,
188 List **parameterDefaults,
189 Oid *variadicArgType,
190 Oid *requiredResultType)
200 bool have_names =
false;
201 bool have_defaults =
false;
213 *parameterDefaults =
NIL;
221 foreach(x, parameters)
225 bool isinput =
false;
238 (
errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
239 errmsg(
"SQL function cannot accept shell type %s",
242 else if (is_aggregate)
244 (
errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
245 errmsg(
"aggregate cannot accept shell type %s",
249 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
250 errmsg(
"argument type %s is only a shell",
259 (
errcode(ERRCODE_UNDEFINED_OBJECT),
260 errmsg(
"type %s does not exist",
273 (
errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
274 errmsg(
"aggregates cannot accept set arguments")));
277 (
errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
278 errmsg(
"functions cannot accept set arguments")));
287 (
errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
288 errmsg(
"VARIADIC parameter must be the last input parameter")));
289 inTypes[inCount++] = toid;
297 *requiredResultType = toid;
303 *variadicArgType = toid;
315 (
errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
316 errmsg(
"VARIADIC parameter must be an array")));
335 foreach(px, parameters)
352 if (prevfp->
name && prevfp->
name[0] &&
353 strcmp(prevfp->
name, fp->
name) == 0)
355 (
errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
356 errmsg(
"parameter name \"%s\" used more than once",
370 (
errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
371 errmsg(
"only input parameters can have default values")));
385 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
386 errmsg(
"cannot use table references in parameter default value")));
402 *parameterDefaults =
lappend(*parameterDefaults, def);
403 have_defaults =
true;
407 if (isinput && have_defaults)
409 (
errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
410 errmsg(
"input parameters after one with a default value must also have defaults")));
421 if (outCount > 0 || varCount > 0)
424 sizeof(
Oid),
true,
'i');
433 *allParameterTypes =
NULL;
434 *parameterModes =
NULL;
439 for (i = 0; i < parameterCount; i++)
448 *parameterNames =
NULL;
471 if (strcmp(defel->
defname,
"volatility") == 0)
473 if (*volatility_item)
474 goto duplicate_error;
476 *volatility_item = defel;
478 else if (strcmp(defel->
defname,
"strict") == 0)
481 goto duplicate_error;
483 *strict_item = defel;
485 else if (strcmp(defel->
defname,
"security") == 0)
488 goto duplicate_error;
490 *security_item = defel;
492 else if (strcmp(defel->
defname,
"leakproof") == 0)
495 goto duplicate_error;
497 *leakproof_item = defel;
499 else if (strcmp(defel->
defname,
"set") == 0)
503 else if (strcmp(defel->
defname,
"cost") == 0)
506 goto duplicate_error;
510 else if (strcmp(defel->
defname,
"rows") == 0)
513 goto duplicate_error;
517 else if (strcmp(defel->
defname,
"parallel") == 0)
520 goto duplicate_error;
522 *parallel_item = defel;
532 (
errcode(ERRCODE_SYNTAX_ERROR),
533 errmsg(
"conflicting or redundant options")));
542 if (strcmp(str,
"immutable") == 0)
544 else if (strcmp(str,
"stable") == 0)
546 else if (strcmp(str,
"volatile") == 0)
550 elog(
ERROR,
"invalid volatility \"%s\"", str);
560 if (strcmp(str,
"safe") == 0)
562 else if (strcmp(str,
"unsafe") == 0)
564 else if (strcmp(str,
"restricted") == 0)
569 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
570 errmsg(
"parallel option \"%s\" not recognized",
586 foreach(l, set_items)
620 bool *security_definer,
641 foreach(option, options)
645 if (strcmp(defel->
defname,
"as") == 0)
649 (
errcode(ERRCODE_SYNTAX_ERROR),
650 errmsg(
"conflicting or redundant options")));
653 else if (strcmp(defel->
defname,
"language") == 0)
657 (
errcode(ERRCODE_SYNTAX_ERROR),
658 errmsg(
"conflicting or redundant options")));
659 language_item = defel;
661 else if (strcmp(defel->
defname,
"transform") == 0)
665 (
errcode(ERRCODE_SYNTAX_ERROR),
666 errmsg(
"conflicting or redundant options")));
667 transform_item = defel;
669 else if (strcmp(defel->
defname,
"window") == 0)
673 (
errcode(ERRCODE_SYNTAX_ERROR),
674 errmsg(
"conflicting or redundant options")));
675 windowfunc_item = defel;
691 elog(
ERROR,
"option \"%s\" not recognized",
701 (
errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
702 errmsg(
"no function body specified")));
707 *language =
strVal(language_item->arg);
711 (
errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
712 errmsg(
"no language specified")));
718 *transform = transform_item->arg;
720 *windowfunc_p =
intVal(windowfunc_item->arg);
724 *strict_p =
intVal(strict_item->arg);
726 *security_definer =
intVal(security_item->arg);
728 *leakproof_p =
intVal(leakproof_item->arg);
736 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
737 errmsg(
"COST must be positive")));
744 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
745 errmsg(
"ROWS must be positive")));
771 foreach(pl, parameters)
785 (
errcode(ERRCODE_SYNTAX_ERROR),
786 errmsg(
"unrecognized function attribute \"%s\" ignored",
803 char *funcname,
List *as,
804 char **prosrc_str_p,
char **probin_str_p)
820 *prosrc_str_p = funcname;
824 if (strcmp(*prosrc_str_p,
"-") == 0)
825 *prosrc_str_p = funcname;
832 *probin_str_p =
NULL;
836 (
errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
837 errmsg(
"only one AS item needed for language \"%s\"",
850 if (strlen(*prosrc_str_p) == 0)
851 *prosrc_str_p = funcname;
870 Oid languageValidator;
879 List *parameterDefaults;
883 Oid requiredResultType;
908 isWindowFunc =
false;
920 &as_clause, &language, &transformDefElem,
921 &isWindowFunc, &volatility,
922 &isStrict, &security, &isLeakProof,
923 &proconfig, &procost, &prorows, ¶llel);
929 (
errcode(ERRCODE_UNDEFINED_OBJECT),
930 errmsg(
"language \"%s\" does not exist", language),
932 errhint(
"Use CREATE LANGUAGE to load the language into the database.") : 0)));
937 if (languageStruct->lanpltrusted)
945 NameStr(languageStruct->lanname));
952 NameStr(languageStruct->lanname));
955 languageValidator = languageStruct->lanvalidator;
966 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
967 errmsg(
"only superuser can define a leakproof function")));
969 if (transformDefElem)
975 foreach(lc, (
List *) transformDefElem)
980 typeid = elt ? elt :
typeid;
983 trftypes_list =
lappend_oid(trftypes_list,
typeid);
1001 &requiredResultType);
1007 &prorettype, &returnsSet);
1008 if (
OidIsValid(requiredResultType) && prorettype != requiredResultType)
1010 (
errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
1011 errmsg(
"function result type must be %s because of OUT parameters",
1017 prorettype = requiredResultType;
1023 (
errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
1024 errmsg(
"function result type must be specified")));
1038 foreach(lc, trftypes_list)
1052 &prosrc_str, &probin_str);
1075 else if (!returnsSet)
1077 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1078 errmsg(
"ROWS is not applicable when function does not return a set")));
1132 elog(
ERROR,
"cache lookup failed for function %u", funcOid);
1151 elog(
ERROR,
"cache lookup failed for pg_aggregate tuple for function %u", funcOid);
1192 elog(
ERROR,
"cache lookup failed for function %u", funcOid);
1201 if (procForm->proisagg)
1203 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
1204 errmsg(
"\"%s\" is an aggregate function",
1220 ¶llel_item) ==
false)
1224 if (volatility_item)
1227 procForm->proisstrict =
intVal(strict_item->
arg);
1228 if (security_def_item)
1229 procForm->prosecdef =
intVal(security_def_item->
arg);
1232 procForm->proleakproof =
intVal(leakproof_item->
arg);
1233 if (procForm->proleakproof && !
superuser())
1235 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
1236 errmsg(
"only superuser can define a leakproof function")));
1241 if (procForm->procost <= 0)
1243 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1244 errmsg(
"COST must be positive")));
1249 if (procForm->prorows <= 0)
1251 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1252 errmsg(
"ROWS must be positive")));
1253 if (!procForm->proretset)
1255 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1256 errmsg(
"ROWS is not applicable when function does not return a set")));
1275 memset(repl_repl,
false,
sizeof(repl_repl));
1290 repl_val, repl_null, repl_repl);
1327 elog(
ERROR,
"cache lookup failed for function %u", funcOid);
1331 elog(
ERROR,
"function %u doesn't return OPAQUE", funcOid);
1334 procForm->prorettype = newRetType;
1361 elog(
ERROR,
"cache lookup failed for function %u", funcOid);
1364 if (argIndex < 0 || argIndex >= procForm->pronargs ||
1365 procForm->proargtypes.values[argIndex] !=
OPAQUEOID)
1366 elog(
ERROR,
"function %u doesn't take OPAQUE", funcOid);
1369 procForm->proargtypes.values[argIndex] = newArgType;
1412 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
1413 errmsg(
"source data type %s is a pseudo-type",
1418 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
1419 errmsg(
"target data type %s is a pseudo-type",
1426 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
1427 errmsg(
"must be owner of type %s or type %s",
1442 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
1443 errmsg(
"cast will be ignored because the source data type is a domain")));
1447 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
1448 errmsg(
"cast will be ignored because the target data type is a domain")));
1453 else if (stmt->
inout)
1468 elog(
ERROR,
"cache lookup failed for function %u", funcid);
1471 nargs = procstruct->pronargs;
1472 if (nargs < 1 || nargs > 3)
1474 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1475 errmsg(
"cast function must take one to three arguments")));
1478 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1479 errmsg(
"argument of cast function must match or be binary-coercible from source data type")));
1480 if (nargs > 1 && procstruct->proargtypes.values[1] !=
INT4OID)
1482 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1483 errmsg(
"second argument of cast function must be type integer")));
1484 if (nargs > 2 && procstruct->proargtypes.values[2] !=
BOOLOID)
1486 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1487 errmsg(
"third argument of cast function must be type boolean")));
1490 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1491 errmsg(
"return data type of cast function must match or be binary-coercible to target data type")));
1501 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1502 errmsg(
"cast function must not be volatile")));
1504 if (procstruct->proisagg)
1506 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1507 errmsg(
"cast function must not be an aggregate function")));
1508 if (procstruct->proiswindow)
1510 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1511 errmsg(
"cast function must not be a window function")));
1512 if (procstruct->proretset)
1514 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1515 errmsg(
"cast function must not return a set")));
1540 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
1541 errmsg(
"must be superuser to create a cast WITHOUT FUNCTION")));
1551 if (typ1len != typ2len ||
1552 typ1byval != typ2byval ||
1553 typ1align != typ2align)
1555 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1556 errmsg(
"source and target data types are not physically compatible")));
1570 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1571 errmsg(
"composite data types are not binary-compatible")));
1576 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1577 errmsg(
"enum data types are not binary-compatible")));
1582 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1583 errmsg(
"array data types are not binary-compatible")));
1599 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1600 errmsg(
"domain data types must not be marked binary-compatible")));
1607 if (sourcetypeid == targettypeid && nargs < 2)
1609 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1610 errmsg(
"source data type and target data type are the same")));
1643 errmsg(
"cast from type %s to type %s already exists",
1654 MemSet(nulls,
false,
sizeof(nulls));
1669 referenced.
objectId = sourcetypeid;
1675 referenced.
objectId = targettypeid;
1717 (
errcode(ERRCODE_UNDEFINED_OBJECT),
1718 errmsg(
"cast from type %s to type %s does not exist",
1743 elog(
ERROR,
"could not find tuple for cast %u", castOid);
1756 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1757 errmsg(
"transform function must not be volatile")));
1758 if (procstruct->proisagg)
1760 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1761 errmsg(
"transform function must not be an aggregate function")));
1762 if (procstruct->proiswindow)
1764 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1765 errmsg(
"transform function must not be a window function")));
1766 if (procstruct->proretset)
1768 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1769 errmsg(
"transform function must not return a set")));
1770 if (procstruct->pronargs != 1)
1772 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1773 errmsg(
"transform function must take one argument")));
1774 if (procstruct->proargtypes.values[0] !=
INTERNALOID)
1776 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1777 errmsg(
"first argument of transform function must be type \"internal\"")));
1813 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
1814 errmsg(
"data type %s is a pseudo-type",
1819 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
1820 errmsg(
"data type %s is a domain",
1855 elog(
ERROR,
"cache lookup failed for function %u", fromsqlfuncid);
1859 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1860 errmsg(
"return data type of FROM SQL function must be \"internal\"")));
1880 elog(
ERROR,
"cache lookup failed for function %u", tosqlfuncid);
1882 if (procstruct->prorettype !=
typeid)
1884 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1885 errmsg(
"return data type of TO SQL function must be the transform data type")));
1900 MemSet(nulls,
false,
sizeof(nulls));
1912 errmsg(
"transform for type %s language \"%s\" already exists",
1916 MemSet(replaces,
false,
sizeof(replaces));
1960 referenced.
objectId = fromsqlfuncid;
2002 (
errcode(ERRCODE_UNDEFINED_OBJECT),
2003 errmsg(
"transform for type %s language \"%s\" does not exist",
2029 elog(
ERROR,
"could not find tuple for transform %u", transformOid);
2053 (
errcode(ERRCODE_DUPLICATE_FUNCTION),
2054 errmsg(
"function %s already exists in schema \"%s\"",
2077 foreach(arg, stmt->
args)
2081 if (strcmp(defel->
defname,
"as") == 0)
2085 (
errcode(ERRCODE_SYNTAX_ERROR),
2086 errmsg(
"conflicting or redundant options")));
2089 else if (strcmp(defel->
defname,
"language") == 0)
2093 (
errcode(ERRCODE_SYNTAX_ERROR),
2094 errmsg(
"conflicting or redundant options")));
2095 language_item = defel;
2098 elog(
ERROR,
"option \"%s\" not recognized",
2106 (
errcode(ERRCODE_SYNTAX_ERROR),
2107 errmsg(
"no inline code specified")));
2113 language =
"plpgsql";
2119 (
errcode(ERRCODE_UNDEFINED_OBJECT),
2120 errmsg(
"language \"%s\" does not exist", language),
2122 errhint(
"Use CREATE LANGUAGE to load the language into the database.") : 0)));
2128 if (languageStruct->lanpltrusted)
2137 NameStr(languageStruct->lanname));
2144 NameStr(languageStruct->lanname));
2148 laninline = languageStruct->laninline;
2151 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2152 errmsg(
"language \"%s\" does not support inline code execution",
2153 NameStr(languageStruct->lanname))));
Type LookupTypeName(ParseState *pstate, const TypeName *typeName, int32 *typmod_p, bool missing_ok)
#define IsA(nodeptr, _type_)
ArrayType * GUCArrayAdd(ArrayType *array, const char *name, const char *value)
ObjectAddress CreateTransform(CreateTransformStmt *stmt)
#define Anum_pg_cast_castfunc
int errhint(const char *fmt,...)
#define Anum_pg_cast_casttarget
static void check_transform_function(Form_pg_proc procstruct)
void systable_endscan(SysScanDesc sysscan)
#define PROVOLATILE_IMMUTABLE
#define InvokeObjectPostCreateHook(classId, objectId, subId)
char * get_language_name(Oid langoid, bool missing_ok)
#define INTERNALlanguageId
#define RelationGetDescr(relation)
#define ObjectIdAttributeNumber
void DropTransformById(Oid transformOid)
#define TYPTYPE_COMPOSITE
Oid QualifiedNameGetCreationNamespace(List *names, char **objname_p)
Oid get_element_type(Oid typid)
void get_typlenbyvalalign(Oid typid, int16 *typlen, bool *typbyval, char *typalign)
#define PointerGetDatum(X)
char * TypeNameToString(const TypeName *typeName)
#define ProcedureRelationId
void ExecuteDoStmt(DoStmt *stmt)
double defGetNumeric(DefElem *def)
Node * transformExpr(ParseState *pstate, Node *expr, ParseExprKind exprKind)
long deleteDependencyRecordsFor(Oid classId, Oid objectId, bool skipExtensionDeps)
Oid get_language_oid(const char *langname, bool missing_ok)
static void compute_return_type(TypeName *returnType, Oid languageOid, Oid *prorettype_p, bool *returnsSet_p)
ArrayType * construct_array(Datum *elems, int nelems, Oid elmtype, int elmlen, bool elmbyval, char elmalign)
int errcode(int sqlerrcode)
char get_typtype(Oid typid)
#define MemSet(start, val, len)
#define PROPARALLEL_RESTRICTED
static void interpret_AS_clause(Oid languageOid, const char *languageName, char *funcname, List *as, char **prosrc_str_p, char **probin_str_p)
void recordDependencyOn(const ObjectAddress *depender, const ObjectAddress *referenced, DependencyType behavior)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, Datum *values, bool *isnull)
bool contain_var_clause(Node *node)
int pg_strcasecmp(const char *s1, const char *s2)
FormData_pg_type * Form_pg_type
void heap_freetuple(HeapTuple htup)
ObjectAddress TypeShellMake(const char *typeName, Oid typeNamespace, Oid ownerId)
bool pg_type_ownercheck(Oid type_oid, Oid roleid)
List * lappend_oid(List *list, Oid datum)
#define OidIsValid(objectId)
AclResult pg_namespace_aclcheck(Oid nsp_oid, Oid roleid, AclMode mode)
AclResult pg_language_aclcheck(Oid lang_oid, Oid roleid, AclMode mode)
SysScanDesc systable_beginscan(Relation heapRelation, Oid indexId, bool indexOK, Snapshot snapshot, int nkeys, ScanKey key)
#define Anum_pg_cast_castmethod
#define SearchSysCache1(cacheId, key1)
#define Anum_pg_proc_proconfig
void aclcheck_error_type(AclResult aclerr, Oid typeOid)
#define GetSysCacheOid2(cacheId, key1, key2)
#define AggregateRelationId
ParseState * make_parsestate(ParseState *parentParseState)
void assign_expr_collations(ParseState *pstate, Node *expr)
static void compute_attributes_sql_style(List *options, List **as, char **language, Node **transform, bool *windowfunc_p, char *volatility_p, bool *strict_p, bool *security_definer, bool *leakproof_p, ArrayType **proconfig, float4 *procost, float4 *prorows, char *parallel_p)
#define Anum_pg_cast_castsource
Oid get_transform_oid(Oid type_id, Oid lang_id, bool missing_ok)
bool defGetBoolean(DefElem *def)
HeapTuple systable_getnext(SysScanDesc sysscan)
#define ObjectIdGetDatum(X)
#define SearchSysCacheExists3(cacheId, key1, key2, key3)
#define PROVOLATILE_STABLE
ObjectAddress CreateFunction(CreateFunctionStmt *stmt, const char *queryString)
#define OidFunctionCall1(functionId, arg1)
void SetFunctionArgType(Oid funcOid, int argIndex, Oid newArgType)
char * get_namespace_name(Oid nspid)
Oid values[FLEXIBLE_ARRAY_MEMBER]
void aclcheck_error(AclResult aclerr, AclObjectKind objectkind, const char *objectname)
static void compute_attributes_with_style(List *parameters, bool *isStrict_p, char *volatility_p)
int errdetail(const char *fmt,...)
#define CStringGetDatum(X)
void px(PlannerInfo *root, Gene *tour1, Gene *tour2, Gene *offspring, int num_gene, City *city_table)
ObjectAddress AlterFunction(AlterFunctionStmt *stmt)
#define TransformOidIndexId
const char * funcname_signature_string(const char *funcname, int nargs, List *argnames, const Oid *argtypes)
Oid LookupFuncNameTypeNames(List *funcname, List *argtypes, bool noError)
const char * p_sourcetext
void interpret_function_parameter_list(List *parameters, Oid languageOid, bool is_aggregate, const char *queryString, oidvector **parameterTypes, ArrayType **allParameterTypes, ArrayType **parameterModes, ArrayType **parameterNames, List **parameterDefaults, Oid *variadicArgType, Oid *requiredResultType)
#define ereport(elevel, rest)
#define InvokeObjectPostAlterHook(classId, objectId, subId)
static char interpret_func_volatility(DefElem *defel)
#define PROPARALLEL_UNSAFE
bool IsBinaryCoercible(Oid srctype, Oid targettype)
#define PROVOLATILE_VOLATILE
List * lappend(List *list, void *datum)
void IsThereFunctionInNamespace(const char *proname, int pronargs, oidvector *proargtypes, Oid nspOid)
char * NameListToString(List *names)
ArrayType * GUCArrayDelete(ArrayType *array, const char *name)
void * palloc0(Size size)
void ReleaseSysCache(HeapTuple tuple)
static ArrayType * update_proconfig_value(ArrayType *a, List *set_items)
Datum SysCacheGetAttr(int cacheId, HeapTuple tup, AttrNumber attributeNumber, bool *isNull)
Oid simple_heap_insert(Relation relation, HeapTuple tup)
Relation heap_open(Oid relationId, LOCKMODE lockmode)
void SetFunctionReturnType(Oid funcOid, Oid newRetType)
bool PLTemplateExists(const char *languageName)
FormData_pg_proc * Form_pg_proc
ObjectAddress ProcedureCreate(const char *procedureName, Oid procNamespace, bool replace, bool returnsSet, Oid returnType, Oid proowner, Oid languageObjectId, Oid languageValidator, const char *prosrc, const char *probin, bool isAgg, bool isWindowFunc, bool security_definer, bool isLeakProof, bool isStrict, char volatility, char parallel, oidvector *parameterTypes, Datum allParameterTypes, Datum parameterModes, Datum parameterNames, List *parameterDefaults, Datum trftypes, Datum proconfig, float4 procost, float4 prorows)
ObjectAddress CreateCast(CreateCastStmt *stmt)
#define HeapTupleIsValid(tuple)
#define Assert(condition)
oidvector * buildoidvector(const Oid *oids, int n)
void CatalogUpdateIndexes(Relation heapRel, HeapTuple heapTuple)
void recordDependencyOnCurrentExtension(const ObjectAddress *object, bool isReplace)
static int list_length(const List *l)
void simple_heap_delete(Relation relation, ItemPointer tid)
void simple_heap_update(Relation relation, ItemPointer otid, HeapTuple tup)
#define ObjectAddressSet(addr, class_id, object_id)
void RemoveFunctionById(Oid funcOid)
static Datum values[MAXATTR]
Oid get_base_element_type(Oid typid)
#define SearchSysCacheCopy1(cacheId, key1)
FormData_pg_language * Form_pg_language
int errmsg(const char *fmt,...)
AclResult pg_proc_aclcheck(Oid proc_oid, Oid roleid, AclMode mode)
Node * coerce_to_specific_type(ParseState *pstate, Node *node, Oid targetTypeId, const char *constructName)
void ScanKeyInit(ScanKey entry, AttrNumber attributeNumber, StrategyNumber strategy, RegProcedure procedure, Datum argument)
#define CStringGetTextDatum(s)
Oid get_cast_oid(Oid sourcetypeid, Oid targettypeid, bool missing_ok)
#define Anum_pg_cast_castcontext
#define LanguageRelationId
void DropCastById(Oid castOid)
FunctionParameterMode mode
#define HeapTupleGetOid(tuple)
AclResult pg_type_aclcheck(Oid type_oid, Oid roleid, AclMode mode)
void free_parsestate(ParseState *pstate)
HeapTuple heap_modify_tuple(HeapTuple tuple, TupleDesc tupleDesc, Datum *replValues, bool *replIsnull, bool *doReplace)
char * ExtractSetVariableArgs(VariableSetStmt *stmt)
static bool compute_common_attribute(DefElem *defel, DefElem **volatility_item, DefElem **strict_item, DefElem **security_item, DefElem **leakproof_item, List **set_items, DefElem **cost_item, DefElem **rows_item, DefElem **parallel_item)
#define ERRCODE_DUPLICATE_OBJECT
#define BTEqualStrategyNumber
bool pg_proc_ownercheck(Oid proc_oid, Oid roleid)
Oid typenameTypeId(ParseState *pstate, const TypeName *typeName)
static char interpret_func_parallel(DefElem *defel)
#define DatumGetArrayTypeP(X)
#define SearchSysCache2(cacheId, key1, key2)