Re: plpgsql keywords are hidden reserved words - Mailing list pgsql-hackers

From Tom Lane
Subject Re: plpgsql keywords are hidden reserved words
Date
Msg-id 23085.1194285255@sss.pgh.pa.us
Whole thread Raw
In response to Re: plpgsql keywords are hidden reserved words  (Gregory Stark <stark@enterprisedb.com>)
List pgsql-hackers
Gregory Stark <stark@enterprisedb.com> writes:
> "Tom Lane" <tgl@sss.pgh.pa.us> writes:
>> This works fine in 8.2.  The reason it no longer works is that "query"
>> is now a special token in the plpgsql lexer, and that means that it will
>> never be substituted for by read_sql_construct().  So it's effectively
>> a reserved word.

> Perhaps we should be throwing a more intelligible error if you have a
> parameter (or variable?) named in a way that will conflict?

Actually, it seems you already do get such a complaint if you try to
use a keyword as a variable name:

ERROR:  syntax error at or near "query"
LINE 2: declare query text;               ^

Not the most tremendously helpful message, maybe, but at least it's
pointing at the right place.  So the problem is only for function
parameter names, which aren't lexed by plpgsql itself but by the main
parser.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: Open items for 8.3
Next
From: Tom Lane
Date:
Subject: Re: plpgsql keywords are hidden reserved words