Re: Missing semicolumn in anonymous plpgsql block does not raise syntax error

From: Erik Wienhold <ewie(at)ewie(dot)name>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Mor Lehr <mor(dot)lehr(at)deel(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: Missing semicolumn in anonymous plpgsql block does not raise syntax error
Date: 2024-06-03 16:45:54
Message-ID: 30ebb5a3-ca61-4b74-bb98-7c2dc0622e52@ewie.name
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 2024-06-03 00:18 +0200, Tom Lane wrote:
> "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> > I think you just wrote the equivalent of:
> > l_cnt := (select 1 as delete from foo3 where id=1);
> > Which is a valid query.
>
> Still another example of the folly of letting AS be optional.
> I don't suppose we can ever undo that though.

How about inventing an opt-in strict mode (like in Perl or JavaScript)
that prevents certain footguns? For example, disallowing bare column
labels.

That could be enabled for the current session or transaction:

SET strict_parsing = { on | off };

Or just for individual routines:

CREATE PROCEDURE myproc()
SET strict_parsing = { on | off }
LANGUAGE plpgsql ...

--
Erik

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2024-06-03 17:50:22 Re: BUG #18492: Adding a toasted column to a table with an inherited temp table fails with Assert
Previous Message PG Bug reporting form 2024-06-03 14:47:16 BUG #18493: COPY FROM STDIN BINARY failure