From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
Cc: | "jiangshan(dot)liu(at)tju(dot)edu(dot)cn" <jiangshan(dot)liu(at)tju(dot)edu(dot)cn>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: BUG #18403: PL/pgSQL is reporting unexpected errors when processing DECLARE blocks with <<label>> |
Date: | 2024-03-20 20:57:06 |
Message-ID: | CAFj8pRA5n-y1-GvffGgwVQZhuFp+3S5AgzY0Rr8SwqLyfwi9eA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
st 20. 3. 2024 v 21:47 odesílatel David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)com> napsal:
> On Wednesday, March 20, 2024, PG Bug reporting form <
> noreply(at)postgresql(dot)org> wrote:
>
>> The following bug has been logged on the website:
>>
>> Bug reference: 18403
>> Logged by: Jiangshan Liu
>> Email address: jiangshan(dot)liu(at)tju(dot)edu(dot)cn
>> PostgreSQL version: 15.2
>> Operating system: Ubuntu
>> Description:
>>
>> Hi, I think PL/pgSQL is reporting unexpected errors when dealing with
>> DECLARE blocks paired with <<label>>.
>> I have approximated the program to a clean situation. When I execute this
>> program, the PL/pgSQL engine does not report errors to me:
>>
>> DO $$
>> DECLARE
>> DECLARE
>> var1 INT = 1;
>> BEGIN
>> RAISE NOTICE '%', var1;
>> END;
>> $$;
>
>
>
> The failure to report an error here seems contrary to the documentation.
> When the end of the DO text is reached and only a single begin/end pair is
> seen the parser is being loose in being OK that one of the declares was not
> associated with a full block.
>
One block can have more DECLAREs
I am not sure if the empty list for DECLARE should be valid, but plpgsql
parser allows it.
do $$
declare x int;
declare y int;
begin
x := 1; y := 1;
raise notice '% %', x,y;
end;
$$;
> David J.
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2024-03-20 21:02:06 | Re: BUG #18403: PL/pgSQL is reporting unexpected errors when processing DECLARE blocks with <<label>> |
Previous Message | David G. Johnston | 2024-03-20 20:47:52 | BUG #18403: PL/pgSQL is reporting unexpected errors when processing DECLARE blocks with <<label>> |