smart(er) column aliases - Mailing list pgsql-sql

From Iain Sinclair
Subject smart(er) column aliases
Date
Msg-id 003501c38ef2$9c041950$6501a8c0@local.mst.co.jp
Whole thread Raw
List pgsql-sql
Hi all,
 
To take a simple example here is what I wanted to do:
 
   select 1 as one, 2 as two, one + two as three;
 
but it doesn't work. I've checked it out though, and I found that I can do this:
 
   select one, two, one + two from (select 1 as one, 2 as two) as a;
 
which is acceptable, I guess.
 
I'm using 7.1 (I think) and will update to 7.3 soon but I guess that the first query still doesn't work.
 
I'd just like to suggest to the gurus developing this DB that it would be realy cool if the first query was possible. For me it's just about 2 things: simplicity and efficiency. The queries I'm working on at the moment are a little too complex for my liking and the "1" in this example is typically a call to a very involved function whose result is re-used in a number of calculations. Obviously, I only want to so it once, and and I want to keep the main query as simple as possible as things are already out of hand...
 
cheers all.
 
Iain

pgsql-sql by date:

Previous
From: "Thomas Wegner"
Date:
Subject: Re: Oracle 'connect by prior' now eaiser in 7.3?
Next
From: "Bill Pfeiffer"
Date:
Subject: Re: PG equivalent to Sybase varbinary