Re: Understanding Aliases

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Understanding Aliases
Дата
Msg-id 14378.1197386869@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Understanding Aliases  ("Stanislav Raskin" <sr@brainswell.de>)
Ответы Re: Understanding Aliases  ("Stanislav Raskin" <sr@brainswell.de>)
Список pgsql-general
"Stanislav Raskin" <sr@brainswell.de> writes:
> Still no Idea why it does not work with the alias.

SELECT-list output aliases name the *output* columns of the SELECT.
Those output columns are not available to the SELECT's computation
clauses.  Otherwise you'd have a logical circularity --- by definition,
the output row(s) can't have been computed yet when you're evaluating
a WHERE condition.

People frequently think that because ORDER BY can refer to the
output-column aliases, other clauses should be able to do it too,
but this is not so.  Conceptually, ORDER BY happens after computation
of the output rows, so there's no logical inconsistency in allowing
it to do that ... but it's certainly confused enough people that
one wonders whether the SQL committee shouldn't have left that wart
out of the language.

            regards, tom lane

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

Предыдущее
От: "A. Kretschmer"
Дата:
Сообщение: Re: Hijack!
Следующее
От: "Mason Hale"
Дата:
Сообщение: Re: partitioned table query question