| From: | "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk> |
|---|---|
| To: | hackers(at)postgreSQL(dot)org |
| Subject: | HAVING bug in 6.4.2 |
| Date: | 1999-02-09 00:02:11 |
| Message-ID: | 199902090002.AAA02110@linda.lfix.co.uk |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
HAVING appears not to recognise alias names for columns.
Examples:
** Using aggregate in HAVING clause works **
bray=> select p.brand,avg(s.free) as f from product as p, stock as s where
p.id = s.product group by p.brand having avg(s.free) > 100;
brand | f
------------+----
AVOCA | 660
BULK | 122
...
|5481
(14 rows)
** Using various kinds of column names in HAVING clause does not work **
bray=> select p.brand,avg(s.free) as f from product as p, stock as s where
p.id = s.product group by p.brand having f > 100;
ERROR: attribute 'f' not found
bray=> select p.brand,avg(s.free) as f from product as p, stock as s where
p.id = s.product group by p.brand having 2 > 100;
brand|f
-----+-
(0 rows)
bray=> select p.brand,avg(s.free) from product as p, stock as s where p.id =
s.product group by p.brand having 2 > 100;
brand|avg
-----+---
(0 rows)
Is this a known bug?
--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP key from public servers; key ID 32B8FAA1
========================================
"The heavens declare the glory of God; and the
firmament showeth his handiwork." Psalms 19:1
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 1999-02-09 00:02:22 | Re: [HACKERS] samekeys |
| Previous Message | Tom Lane | 1999-02-08 23:55:34 | Re: [HACKERS] Problems with >2GB tables on Linux 2.0 |