Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sEAp0-0001lz-Q7 for pgsql-bugs@arkaria.postgresql.org; Mon, 03 Jun 2024 16:46:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sEAp0-00BWlG-CE for pgsql-bugs@arkaria.postgresql.org; Mon, 03 Jun 2024 16:46:10 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sEAoz-00BWl8-Tr for pgsql-bugs@lists.postgresql.org; Mon, 03 Jun 2024 16:46:10 +0000 Received: from mout-u-107.mailbox.org ([2001:67c:2050:101:465::107]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sEAos-003HAv-On for pgsql-bugs@lists.postgresql.org; Mon, 03 Jun 2024 16:46:08 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-107.mailbox.org (Postfix) with ESMTPS id 4VtKNh1JN7z9sq7; Mon, 3 Jun 2024 18:45:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ewie.name; s=MBO0001; t=1717433156; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=CRbVZieC6OgLtRk9gx3Wu2rniVSEX/2nDVoTFFoa0rA=; b=ymEedH/tjcWQ4IiWY8npVWB52LkrUYzjk1ZTR0ut6xyk7xbETHNFijcqTkkTRHpOGUfT6c k5TLDKwMTFWnoTZCacYdpiFc+gpoNer5bSnMeybb15n33oROLGwB4RusqAHVV/xfOc0oYQ V6RoY6/OADlkRLhTyLHGzC8SFdWsfv0/NLI5SkXDPw6HGhZZFgNa2Tb1SGa3AI6Gdg580i zemPRiYfndFlBbIEBRUrW/uZcCWTYBgA0YdvUp4OC8QYKxyL3DgAQqDX9qUd/IgxU2ou8j dY8YpYDYDpuQNZ8krYz7tbPdPiKyI2V5pzW+WBdC7vYBy7W71Fh9Btp0F/va5A== Date: Mon, 3 Jun 2024 18:45:54 +0200 From: Erik Wienhold To: Tom Lane Cc: "David G. Johnston" , Mor Lehr , "pgsql-bugs@lists.postgresql.org" Subject: Re: Missing semicolumn in anonymous plpgsql block does not raise syntax error Message-ID: <30ebb5a3-ca61-4b74-bb98-7c2dc0622e52@ewie.name> References: <2365647.1717366731@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2365647.1717366731@sss.pgh.pa.us> X-Rspamd-Queue-Id: 4VtKNh1JN7z9sq7 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2024-06-03 00:18 +0200, Tom Lane wrote: > "David G. Johnston" 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