Re: Re: BUG #8633: Assigning to a variable named "current_time" gives wrong output

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Re: BUG #8633: Assigning to a variable named "current_time" gives wrong output
Дата
Msg-id 19673.1385576031@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #8633: Assigning to a variable named "current_time" gives wrong output  (David Johnston <polobo@yahoo.com>)
Ответы Re: BUG #8633: Assigning to a variable named "current_time" gives wrong output
Список pgsql-bugs
David Johnston <polobo@yahoo.com> writes:
> bricklen wrote
>> I don't think this is a bug, "current_time" is a reserved word. See
>> http://www.postgresql.org/docs/current/static/sql-keywords-appendix.html

> Agreed; though I am curious why this does not throw an error during the
> declaration or assignment. A spurious parser error would be welcomed
> compared to silently ignoring the requested action.

Well, it's not "ignoring the action", it's just that the keyword meaning
now takes precedence in expressions.  We changed that in 9.0 I believe.

We could possibly throw an error if you use a SQL reserved word in a
declaration without double-quoting it.  That wouldn't be a complete fix,
because if you did that and then forgot to double-quote the name in
expressions, it'd still do the wrong thing.  But this might at least
help you remember you need to do that.

I think though that at one time it was considered a feature that we
didn't insist on double-quoting plpgsql variable names unnecessarily.
Don't know if changing this would be a net improvement for everyone.

            regards, tom lane

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: BUG #8434: Why does dead lock occur many times ?
Следующее
От: David Johnston
Дата:
Сообщение: Re: BUG #8633: Assigning to a variable named "current_time" gives wrong output