Re: [GENERAL] can not use the column after rename

2011-12-21 Thread Tom Lane
salah jubeh 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? Th

Re: [GENERAL] can not use the column after rename

2011-12-21 Thread David Johnston
From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of salah jubeh Sent: Wednesday, December 21, 2011 6:39 AM To: pgsql Subject: [GENERAL] can not use the column after rename Hello, Why I can not do something like this in Postgres. SELECT 1

Re: [GENERAL] can not use the column after rename

2011-12-21 Thread Marti Raudsepp
On Wed, Dec 21, 2011 at 15:24, salah jubeh wrote: > 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? As far as I know, that's how the SQL standard specifies it. PostgreS

Re: [GENERAL] can not use the column after rename

2011-12-21 Thread salah jubeh
, 2011 1:14 PM Subject: Re: [GENERAL] can not use the column after rename Hi Salah, This is equivalent: WITH numbers AS (SELECT 1 AS a, 2 AS b) SELECT a, b, a+b AS c FROM numbers; S On Wed, Dec 21, 2011 at 11:39 AM, salah jubeh wrote: Hello, > > > >Why I can not do something

Re: [GENERAL] can not use the column after rename

2011-12-21 Thread Simon Tokumine
Hi Salah, This is equivalent: WITH numbers AS (SELECT 1 AS a, 2 AS b) SELECT a, b, a+b AS c FROM numbers; S On Wed, Dec 21, 2011 at 11:39 AM, salah jubeh wrote: > Hello, > > Why I can not do something like this in Postgres. > > SELECT 1 as a , 2 as b , a + b as c ; > > Regards > > >