Search Postgresql Archives

Re: can not use the column after rename

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

 



salah jubeh <s_jubeh@xxxxxxxxx> 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 the theoretical 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

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[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