Re: BUG #15555: Syntax errors when using the COMMENT command in plpgsql and a "comment" variable - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #15555: Syntax errors when using the COMMENT command in plpgsql and a "comment" variable
Date
Msg-id 32114.1545079626@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #15555: Syntax errors when using the COMMENT command in plpgsql and a "comment" variable  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #15555: Syntax errors when using the COMMENT command in plpgsql and a "comment" variable
List pgsql-bugs
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


pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #15548: Unaccent does not remove combining diacritical characters
Next
From: Tom Lane
Date:
Subject: Re: BUG #15555: Syntax errors when using the COMMENT command in plpgsql and a "comment" variable