mirror of
https://git.postgresql.org/git/postgresql.git
synced 2026-02-09 00:47:41 +08:00
Allow plpgsql function parameter names to be qualified with the function's
name. With this patch, it is always possible for the user to qualify a plpgsql variable name if needed to avoid ambiguity. While there is much more work to be done in this area, this simple change removes one unnecessary incompatibility with Oracle. Per discussion.
This commit is contained in:
@ -2535,3 +2535,25 @@ select * from sc_test();
|
||||
|
||||
drop function sc_test();
|
||||
|
||||
-- test qualified variable names
|
||||
|
||||
create function pl_qual_names (param1 int) returns void as $$
|
||||
<<outerblock>>
|
||||
declare
|
||||
param1 int := 1;
|
||||
begin
|
||||
<<innerblock>>
|
||||
declare
|
||||
param1 int := 2;
|
||||
begin
|
||||
raise notice 'param1 = %', param1;
|
||||
raise notice 'pl_qual_names.param1 = %', pl_qual_names.param1;
|
||||
raise notice 'outerblock.param1 = %', outerblock.param1;
|
||||
raise notice 'innerblock.param1 = %', innerblock.param1;
|
||||
end;
|
||||
end;
|
||||
$$ language plpgsql;
|
||||
|
||||
select pl_qual_names(42);
|
||||
|
||||
drop function pl_qual_names(int);
|
||||
|
||||
Reference in New Issue
Block a user