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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-sql by date

  From Date Subject
Next Message Rod Taylor 2004-02-13 13:57:20 Re: 7.4 - FK constraint performance
Previous Message David 2004-02-13 10:25:10 arrays and polygons