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

Function add_parameter_name

src/pl/plpgsql/src/pl_comp.c:1029–1049  ·  view source on GitHub ↗

* Add a name for a function parameter to the function's namespace */

Source from the content-addressed store, hash-verified

1027 * Add a name for a function parameter to the function's namespace
1028 */
1029static void
1030add_parameter_name(PLpgSQL_nsitem_type itemtype, int itemno, const char *name)
1031{
1032 /*
1033 * Before adding the name, check for duplicates. We need this even though
1034 * functioncmds.c has a similar check, because that code explicitly
1035 * doesn't complain about conflicting IN and OUT parameter names. In
1036 * plpgsql, such names are in the same namespace, so there is no way to
1037 * disambiguate.
1038 */
1039 if (plpgsql_ns_lookup(plpgsql_ns_top(), true,
1040 name, NULL, NULL,
1041 NULL) != NULL)
1042 ereport(ERROR,
1043 (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
1044 errmsg("parameter name \"%s\" used more than once",
1045 name)));
1046
1047 /* OK, add the name */
1048 plpgsql_ns_additem(itemtype, itemno, name);
1049}
1050
1051/*
1052 * Add a dummy RETURN statement to the given function's body

Callers 1

do_compileFunction · 0.85

Calls 5

plpgsql_ns_lookupFunction · 0.85
plpgsql_ns_topFunction · 0.85
plpgsql_ns_additemFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected