On Mon, Mar 15, 2021 at 05:31:18AM +0100, Pavel Stehule wrote: > Thank you very much
I am not much a fan of the implementation done here. Based on my
understanding of the PL code, the namespace lookup is organized as a
list of items, with the namespace associated to the routine name being
the first one pushed to the list after plpgsql_ns_init() initializes
the top of it. Then, the proposed patch hijacks the namespace lookup
list by doing a replacement of the root label while parsing the
routine and then tweaks the lookup logic when a variable is qualified
(aka name2 != NULL) to bump the namespace list one level higher so as
it does not look after the namespace with the routine name but instead
fetches the one defined by ROUTINE_NAME. That seems rather bug-prone
to me, to say the least.
No changes to plpgsql_compile_inline()?
+ ereport(ERROR,
+ (errcode(ERRCODE_SYNTAX_ERROR),
+ errmsg("redundant option"),
+ errhint("The command \"routine_label\" can be used
only once in rutine."),
+ plpgsql_scanner_errposition(location)));
s/rutine/routine/
+ /* Don't allow repeated redefination of routine label */
redefination?
I am wondering whether it would be better to allow multiple aliases
though, and if it would bring more readability to the routines written
if these are treated equal to the top-most namespace which is the
routine name now, meaning that we would maintain not one, but N top
namespace labels that could be used as aliases of the root one.
--
Michael
signature.asc
Description: PGP signature
