Skip site navigation (1) Skip section navigation (2)

column alias and group by/having/order

From: Tomasz Myrta <jasiek(at)klaster(dot)net>
To: Lista dyskusyjna pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: column alias and group by/having/order
Date: 2004-02-13 13:34:54
Message-ID: 402CD27E.7050001@klaster.net (view raw or flat)
Thread:
Lists: pgsql-sql
Hi
I found some strange column alias behaviour:

select val1+val2 as val
from some_table
group by val;

result - OK

select val1+val2 as val
from some_table
order by val;

result - OK

select val1+val2 as val
from some_table
group by val having val1+val2>1;

result - OK

select val1+val2 as val
from some_table
group by val having val>1;
ERROR:  Attribute "val" not found

Is it a bug or a feature?

Regards,
Tomasz Myrta

----------------------------------------------------------------------------------------------------------------
  PostgreSQL 7.3.4 on i386-pc-linux-gnu, compiled by GCC i386-linux-gcc 
(GCC) 3.3.2 20031005 (Debian prerelease)

Responses

pgsql-sql by date

Next:From: Rod TaylorDate: 2004-02-13 13:57:20
Subject: Re: 7.4 - FK constraint performance
Previous:From: DavidDate: 2004-02-13 10:25:10
Subject: arrays and polygons

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group