Re: plpgsql keywords are hidden reserved words

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: plpgsql keywords are hidden reserved words
Date: 2007-11-05 17:54:15
Message-ID: 23085.1194285255@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Gregory Stark <stark(at)enterprisedb(dot)com> writes:
> "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua D. Drake 2007-11-05 17:54:21 Re: Open items for 8.3
Previous Message Bruce Momjian 2007-11-05 17:47:10 Open items for 8.3