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

Function findRangeCanonicalFunction

src/backend/commands/typecmds.c:2458–2497  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2456}
2457
2458static Oid
2459findRangeCanonicalFunction(List *procname, Oid typeOid)
2460{
2461 Oid argList[1];
2462 Oid procOid;
2463 AclResult aclresult;
2464
2465 /*
2466 * Range canonical functions must take and return the range type, and must
2467 * be immutable.
2468 */
2469 argList[0] = typeOid;
2470
2471 procOid = LookupFuncName(procname, 1, argList, true);
2472
2473 if (!OidIsValid(procOid))
2474 ereport(ERROR,
2475 (errcode(ERRCODE_UNDEFINED_FUNCTION),
2476 errmsg("function %s does not exist",
2477 func_signature_string(procname, 1, NIL, argList))));
2478
2479 if (get_func_rettype(procOid) != typeOid)
2480 ereport(ERROR,
2481 (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2482 errmsg("range canonical function %s must return range type",
2483 func_signature_string(procname, 1, NIL, argList))));
2484
2485 if (func_volatile(procOid) != PROVOLATILE_IMMUTABLE)
2486 ereport(ERROR,
2487 (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2488 errmsg("range canonical function %s must be immutable",
2489 func_signature_string(procname, 1, NIL, argList))));
2490
2491 /* Also, range type's creator must have permission to call function */
2492 aclresult = pg_proc_aclcheck(procOid, GetUserId(), ACL_EXECUTE);
2493 if (aclresult != ACLCHECK_OK)
2494 aclcheck_error(aclresult, OBJECT_FUNCTION, get_func_name(procOid));
2495
2496 return procOid;
2497}
2498
2499static Oid
2500findRangeSubtypeDiffFunction(List *procname, Oid subtype)

Callers 1

DefineRangeFunction · 0.85

Calls 10

LookupFuncNameFunction · 0.85
func_signature_stringFunction · 0.85
get_func_rettypeFunction · 0.85
func_volatileFunction · 0.85
pg_proc_aclcheckFunction · 0.85
GetUserIdFunction · 0.85
aclcheck_errorFunction · 0.85
get_func_nameFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected