From: | Josh Berkus <josh(at)agliodbs(dot)com> |
---|---|
To: | pgsql-bugs(at)postgreSQL(dot)org |
Subject: | Aliased SubSelect in HAVING clause bug -- in progress? |
Date: | 2003-03-12 04:57:29 |
Message-ID: | 200303112057.29399.josh@agliodbs.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Folks,
I don't think I'm the first to report this, but:
SELECT a.id, b.type, max(b.number),
(SELECT count(*) from c where c.b_type = b.type) as count_c
FROM a, b
WHERE a.id = b.a_id
GROUP BY a.id, b.type
HAVING count_c > 2;
Will get a:
ERROR: Attribute "count_c" not found.
It seems that subselects aliased in the SELECT clause of a GROUP BY query
cannot be referenced in the HAVING or ORDER BY clauses of any query.
I'd guess that this is being worked on for 7.4/8.0?
Thanks!
--
-Josh Berkus
Aglio Database Solutions
San Francisco
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-03-12 06:13:40 | Re: Aliased SubSelect in HAVING clause bug -- in progress? |
Previous Message | Bruno Wolff III | 2003-03-11 11:38:55 | Re: performance for MIN,MAX aggregates |