pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Erik Wienhold <ewie@ewie.name>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: Mor Lehr <mor.lehr@deel.com>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: Missing semicolumn in anonymous plpgsql block does not raise syntax error
Date: Mon, 3 Jun 2024 18:45:54 +0200
Message-ID: <30ebb5a3-ca61-4b74-bb98-7c2dc0622e52@ewie.name> (raw)
In-Reply-To: <2365647.1717366731@sss.pgh.pa.us>
References: <CALyvM2bp_CXMH_Gyq87pmHJRuZDEhV40u9VP8rX=CAnEt2wUXg@mail.gmail.com>
	<CAKFQuwZJUc8pqt402u9VjAEgGEMR-Rbu2b5nieeJ_bUzQChrXA@mail.gmail.com>
	<2365647.1717366731@sss.pgh.pa.us>

On 2024-06-03 00:18 +0200, Tom Lane wrote:
> "David G. Johnston" <david.g.johnston@gmail.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





view thread (13+ messages)  latest in thread

Message-ID: <30ebb5a3-ca61-4b74-bb98-7c2dc0622e52@ewie.name>
Permalink:  ../30ebb5a3-ca61-4b74-bb98-7c2dc0622e52@ewie.name/
Also on:    postgresql.org/message-id/30ebb5a3-ca61-4b74-bb98-7c2dc0622e52@ewie.name

 · 

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: ewie@ewie.name, tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, mor.lehr@deel.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: Missing semicolumn in anonymous plpgsql block does not raise syntax error
  In-Reply-To: <30ebb5a3-ca61-4b74-bb98-7c2dc0622e52@ewie.name>

* 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