Re: can not use the column after rename

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: can not use the column after rename
Дата
Msg-id 5866.1324483584@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: can not use the column after rename  (salah jubeh <s_jubeh@yahoo.com>)
Список pgsql-general
salah jubeh <s_jubeh@yahoo.com> writes:
> On the row level,� the value of a and b are know, so why we need a temporary table or CTE. Why I can not use it
directly�as shown in the example below. why a and b can not be used as aliases for the column names ? I want to know
thetheoretical reason behind it? 

The SQL standard envisions all the expressions in a SELECT list being
computed concurrently and independently.  So they can't refer to each
other.  If they could, it would introduce ambiguity.  Consider a table
t that provides columns x,y,z, and suppose we have

    SELECT x AS z, y, y+z AS sum FROM t;

If cross-references were allowed, it would be unclear what the last "z"
is supposed to refer to.

            regards, tom lane

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

Предыдущее
От: "Dara Olson"
Дата:
Сообщение: Re: out of memory error with loading pg_dumpall
Следующее
От: Tom Lane
Дата:
Сообщение: Re: out of memory error with loading pg_dumpall