Re: Parsing error with begin atomic syntax used in a do block

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Samuel Dussault <Samuel(dot)Dussault(at)USherbrooke(dot)ca>
Cc: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: Parsing error with begin atomic syntax used in a do block
Date: 2024-01-18 02:30:07
Message-ID: 2176911.1705545007@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I wrote:
> The problem here is that "begin" is a reserved word in plpgsql
> (and for that matter, so is "end").

Oh! I'm mistaken, that is not the issue. The problem is that
plpgsql assumes that the SQL command ends at the first semicolon.

psql has pretty much this same issue of "does this semicolon end
the command", and it has some heuristics for dealing with that.
Since that's survived awhile now without complaints, we could do
worse than to propagate the identical heuristics into plpgsql,
more or less as attached.

(This also fixes the same problem for multi-command CREATE RULE,
which has been broken in plpgsql since the late bronze age;
but there were not enough people complaining to prompt a fix.)

regards, tom lane

Attachment Content-Type Size
plpgsql-parse-new-style-create-func.patch text/x-diff 7.8 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message vignesh C 2024-01-18 06:52:12 Re: [16+] subscription can end up in inconsistent state
Previous Message Jeff Davis 2024-01-18 01:52:11 Re: [16+] subscription can end up in inconsistent state