pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: jiangshan.liu@tju.edu.cn
Subject: BUG #18403: PL/pgSQL is reporting unexpected errors when processing DECLARE blocks with <<label>>
Date: Wed, 20 Mar 2024 19:35:22 +0000
Message-ID: <18403-7069fc75f5255783@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      18403
Logged by:          Jiangshan Liu
Email address:      jiangshan.liu@tju.edu.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;
$$;

But when I try to add <<label>> before the second DECLARE block, the
PL/pgSQL engine prompts me with this error message:

DO $$
DECLARE
<<label>>
DECLARE
    var1 INT = 1;
BEGIN
    RAISE NOTICE '%', var1;
END;
$$;

> ERROR:  block label must be placed before DECLARE, not after
LINE 3: <<label>>
        ^

It seems to think that I am adding <<label>> after the first DECLARE block,
which is not my intention. I do add the <<label>> before the second DECLARE
block. Why is this program being reported as an error? Is this a bug in
PL/pgSQL's handling of <<label>>?

Looking forward and thank you for your response to this question.



view thread (5+ messages)  latest in thread

Message-ID: <18403-7069fc75f5255783@postgresql.org>
Permalink:  ../18403-7069fc75f5255783@postgresql.org/
Also on:    postgresql.org/message-id/18403-7069fc75f5255783@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, jiangshan.liu@tju.edu.cn
  Subject: Re: BUG #18403: PL/pgSQL is reporting unexpected errors when processing DECLARE blocks with <<label>>
  In-Reply-To: <18403-7069fc75f5255783@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox