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

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Samuel Dussault <Samuel.Dussault@USherbrooke.ca>
Cc: "pgsql-bugs@lists.postgresql.org" <pgsql-bugs@lists.postgresql.org>
Date: 2024-01-18T02:30:07Z
Lists: pgsql-bugs

Attachments

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

Commits

  1. Fix plpgsql to allow new-style SQL CREATE FUNCTION as a SQL command.