Parsing error with begin atomic syntax used in a do block

From: Samuel Dussault <Samuel(dot)Dussault(at)USherbrooke(dot)ca>
To: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Parsing error with begin atomic syntax used in a do block
Date: 2024-01-17 21:18:17
Message-ID: YT2PR01MB88552C3E9AD40A6C038774A781722@YT2PR01MB8855.CANPRD01.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

I encounter a problem when creating a procedure using the begin atomic syntax in a script encapsulated in a DO block. When executing the DO block, the parser throws a syntax error. I would expect to be able to create the procedure with both the new begin atomic and the old syntax.

The attached script, demo.sql, highlights the problem and expected behaviours. First, it prints the PostgreSQL version, creates an example table and sets the verbosity parameter to verbose. Then, it successfully creates a procedure using the new begin atomic syntax. Afterwards, it successfully creates the same function using the old syntax but encapsulates the instruction in a do block. Finally, it fails to create the same function using the new syntax with the do block.

The attached file demo.out shows the output I get when executing the script using psql (version: psql (PostgreSQL) 16.0):
PGPASSWORD=postgres psql -h localhost -U postgres -p 15432 -d postgres -f demo.sql &> demo.out

Thank you for your time,
Samuel Dussault

Attachment Content-Type Size
demo.sql application/octet-stream 1010 bytes
demo.out application/octet-stream 903 bytes

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2024-01-17 23:17:27 Re: Parsing error with begin atomic syntax used in a do block
Previous Message Leo Gaspard 2024-01-17 18:53:01 jsonb numerics are treated as arrays