MCPcopy Create free account
hub / github.com/apache/cloudberry / CreateFunction

Function CreateFunction

src/backend/commands/functioncmds.c:1379–1709  ·  view source on GitHub ↗

* CreateFunction * Execute a CREATE FUNCTION (or CREATE PROCEDURE) utility statement. */

Source from the content-addressed store, hash-verified

1377 * Execute a CREATE FUNCTION (or CREATE PROCEDURE) utility statement.
1378 */
1379ObjectAddress
1380CreateFunction(ParseState *pstate, CreateFunctionStmt *stmt)
1381{
1382 char *probin_str;
1383 char *prosrc_str;
1384 Node *prosqlbody;
1385 Oid prorettype;
1386 bool returnsSet;
1387 char *language;
1388 Oid languageOid;
1389 Oid languageValidator;
1390 Node *transformDefElem = NULL;
1391 char *funcname;
1392 Oid namespaceId;
1393 AclResult aclresult;
1394 oidvector *parameterTypes;
1395 List *parameterTypes_list = NIL;
1396 ArrayType *allParameterTypes;
1397 ArrayType *parameterModes;
1398 ArrayType *parameterNames;
1399 List *inParameterNames_list = NIL;
1400 List *parameterDefaults;
1401 Oid variadicArgType;
1402 List *trftypes_list = NIL;
1403 ArrayType *trftypes;
1404 Oid requiredResultType;
1405 bool isWindowFunc,
1406 isStrict,
1407 security,
1408 isLeakProof;
1409 char volatility;
1410 ArrayType *proconfig;
1411 float4 procost;
1412 float4 prorows;
1413 Oid prosupport;
1414 HeapTuple languageTuple;
1415 Form_pg_language languageStruct;
1416 List *as_clause;
1417 char parallel;
1418 List *describeQualName = NIL;
1419 Oid describeFuncOid = InvalidOid;
1420 char dataAccess;
1421 char execLocation;
1422 ObjectAddress objAddr;
1423 CreateFunctionStmt *original_stmt = copyObject(stmt);
1424
1425 SIMPLE_FAULT_INJECTOR("create_function_fail");
1426 /* Convert list of names to a name and namespace */
1427 namespaceId = QualifiedNameGetCreationNamespace(stmt->funcname,
1428 &funcname);
1429
1430 /* Check we have creation rights in target namespace */
1431 aclresult = pg_namespace_aclcheck(namespaceId, GetUserId(), ACL_CREATE);
1432 if (aclresult != ACLCHECK_OK)
1433 aclcheck_error(aclresult, OBJECT_SCHEMA,
1434 get_namespace_name(namespaceId));
1435
1436 /* Set default attributes */

Callers 1

ProcessUtilitySlowFunction · 0.85

Calls 15

pg_namespace_aclcheckFunction · 0.85
GetUserIdFunction · 0.85
aclcheck_errorFunction · 0.85
get_namespace_nameFunction · 0.85
SearchSysCache1Function · 0.85
extension_file_existsFunction · 0.85
getDefaultDataAccessFunction · 0.85
pg_language_aclcheckFunction · 0.85
superuserFunction · 0.85
ReleaseSysCacheFunction · 0.85

Tested by

no test coverage detected