Re: plpgsql keywords are hidden reserved words

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: plpgsql keywords are hidden reserved words
Дата
Msg-id 23085.1194285255@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: plpgsql keywords are hidden reserved words  (Gregory Stark <stark@enterprisedb.com>)
Список 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 по дате отправления:

Предыдущее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: Open items for 8.3
Следующее
От: Tom Lane
Дата:
Сообщение: Re: plpgsql keywords are hidden reserved words