HAVING bug in 6.4.2

Поиск
Список
Период
Сортировка
От Oliver Elphick
Тема HAVING bug in 6.4.2
Дата
Msg-id 199902090002.AAA02110@linda.lfix.co.uk
обсуждение исходный текст
Список 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.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver              PGP key from public servers; key
ID32B8FAA1                ========================================    "The heavens declare the glory of God; and the
  firmament showeth his handiwork."          Psalms 19:1
 




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Problems with >2GB tables on Linux 2.0
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] samekeys