Re: BUG #7899: allow key word as alias in subquery but Can't reference it in outer query

Поиск
Список
Период
Сортировка
От Jov
Тема Re: BUG #7899: allow key word as alias in subquery but Can't reference it in outer query
Дата
Msg-id CADyrUxNGcAoGCHZ0ZD53CAtr4rvyzaFjO=Eehj_ZRBAqmXj9LA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #7899: allow key word as alias in subquery but Can't reference it in outer query  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: BUG #7899: allow key word as alias in subquery but Can't reference it in outer query  (Jov <amutu@amutu.com>)
Список pgsql-bugs
I have get the description of this behaviour from doc 7.3.2
http://www.postgresql.org/docs/devel/static/queries-select-lists.html#QUERI=
ES-COLUMN-LABELS
.

from the error message now,I think syntax error may emmit by the
parser,parser error make it hard to get the really condition such as the
second token =91end=92 is a select item from a select statement.

thanks

2013/2/22 Tom Lane <tgl@sss.pgh.pa.us>

> "=3D?ISO-8859-1?B?Sm92?=3D" <amutu@amutu.com> writes:
> > xxx=3D# select end from (select 1 as end) t;
> > ERROR:  syntax error at or near "end"
> > LINE 1: select end from (select 1 as end) t;
> >                ^
>
> You need to double-quote the outer use of "end", viz
>
> regression=3D# select "end" from (select 1 as end) t;
>  end
> -----
>    1
> (1 row)
>
> In the context with "as", Postgres can tell the word is meant as a
> column identifier not a keyword, but there's no way for it to know that
> in the outer usage.
>
> > I think use key word as alias should get a error message such as
> $key_word
> > is Key Word,should not be used as identifier bla bla,so for some comple=
x
> > query error user can save a lot of time.
>
> Well, yours is the first complaint we've ever had in that direction,
> whereas we used to get a lot of complaints in the opposite direction,
> back when we didn't allow keywords to be used for column names.
> So I doubt we'll change it.  It is an interesting gotcha though :-(
>
>                         regards, tom lane
> .
>
>


--=20
Jov
blog: http:amutu.com/blog <http://amutu.com/blog>

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #7899: allow key word as alias in subquery but Can't reference it in outer query
Следующее
От: Jov
Дата:
Сообщение: Re: BUG #7899: allow key word as alias in subquery but Can't reference it in outer query