Search Postgresql Archives

Re: Understanding Aliases

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Stanislav Raskin" <sr@xxxxxxxxxxxxx> 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

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
       message can get through to the mailing list cleanly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux