pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: feikesteenbergen@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15555: Syntax errors when using the COMMENT command in plpgsql and a "comment" variable
Date: Mon, 17 Dec 2018 15:47:06 -0500
Message-ID: <32114.1545079626@sss.pgh.pa.us> (raw)
In-Reply-To: <31368.1545078376@sss.pgh.pa.us>
References: <15555-149bbd70ddc7b4b6@postgresql.org>
	<31368.1545078376@sss.pgh.pa.us>

I wrote:
> I wonder whether we could improve matters by adjusting the heuristic for
> such things in pl_scanner.c:
>
>              * If we are at start of statement, prefer unreserved keywords
>              * over variable names, unless the next token is assignment or
>              * '[', in which case prefer variable names.  (Note we need not
>              * consider '.' as the next token; that case was handled above,
>              * and we always prefer variable names in that case.)  If we are
>              * not at start of statement, always prefer variable names over
>              * unreserved keywords.

Digging in the commit history, that code all dates to commit bb1b8f69,
which arose from a discussion about making plpgsql keywords unreserved:

https://www.postgresql.org/message-id/5030.1416778830%40sss.pgh.pa.us

AFAICS, the question of conflicts against core-parser keywords didn't
come up at all in that thread, so it's not surprising we didn't consider
that case.  I don't see any indication that we explicitly rejected
doing something for that case.

There's still the question of whether there are any cases where we
*need* to recognize a variable name that's at statement start and
isn't followed by assignment or '['.

			regards, tom lane




view thread (6+ messages)  latest in thread

Message-ID: <32114.1545079626@sss.pgh.pa.us>
Permalink:  ../32114.1545079626@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/32114.1545079626@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, feikesteenbergen@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #15555: Syntax errors when using the COMMENT command in plpgsql and a "comment" variable
  In-Reply-To: <32114.1545079626@sss.pgh.pa.us>

* 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