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

Function interpret_func_support

src/backend/commands/functioncmds.c:873–910  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

871}
872
873static Oid
874interpret_func_support(DefElem *defel)
875{
876 List *procName = defGetQualifiedName(defel);
877 Oid procOid;
878 Oid argList[1];
879
880 /*
881 * Support functions always take one INTERNAL argument and return
882 * INTERNAL.
883 */
884 argList[0] = INTERNALOID;
885
886 procOid = LookupFuncName(procName, 1, argList, true);
887 if (!OidIsValid(procOid))
888 ereport(ERROR,
889 (errcode(ERRCODE_UNDEFINED_FUNCTION),
890 errmsg("function %s does not exist",
891 func_signature_string(procName, 1, NIL, argList))));
892
893 if (get_func_rettype(procOid) != INTERNALOID)
894 ereport(ERROR,
895 (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
896 errmsg("support function %s must return type %s",
897 NameListToString(procName), "internal")));
898
899 /*
900 * Someday we might want an ACL check here; but for now, we insist that
901 * you be superuser to specify a support function, so privilege on the
902 * support function is moot.
903 */
904 if (!superuser())
905 ereport(ERROR,
906 (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
907 errmsg("must be superuser to specify a support function")));
908
909 return procOid;
910}
911
912
913/*

Callers 2

AlterFunctionFunction · 0.85

Calls 8

defGetQualifiedNameFunction · 0.85
LookupFuncNameFunction · 0.85
func_signature_stringFunction · 0.85
get_func_rettypeFunction · 0.85
NameListToStringFunction · 0.85
superuserFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected