Re: [HACKERS] 6.4 Aggregate Bug and HAVING problems...

From: Vadim Mikheev <vadim(at)krs(dot)ru>
To: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: David Hartwig <daveh(at)insightdist(dot)com>, daybee(at)bellatlantic(dot)net, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] 6.4 Aggregate Bug and HAVING problems...
Date: 1998-09-08 06:40:16
Message-ID: 35F4D150.EFA75826@krs.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Added to TODO:
>
> * select upper(usename), count(usesysid) from pg_shadow group by 1 fails

Fixed. Was broken by new HAVING code...

I see another problems in HAVING:

1.
drop table x;
create table x (a int, b int, c int);
insert into x values (1,1,0);
insert into x values (1,1,1);
select a, min (b) from x group by a having min(b) > c;
-- a|min
-- -+---
-- 1| 1
-- (1 row)
delete from x;
vacuum x;
insert into x values (1,1,1);
insert into x values (1,1,0);
select a, min (b) from x group by a having min(b) > c;
-- a|min
-- -+---
-- (0 rows)

Using C-column is illegal!

2.
vac=> select a, min (b) from x group by a having min(b) > 0 or a = 0;
^^^^^^^^
ERROR: This could have been done in a where clause!!
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
No, couldn't! Using GroupBy expr in having must be allowed.

I'm going to change HAVING behaviour...

Also, could someone test is HAVING without aggregates
disallowed or not:

select a, min (b) from x group by a having a = 0;

- ???

Vadim

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1998-09-08 07:15:17 Re: [HACKERS] Macro From Hell
Previous Message Thomas G. Lockhart 1998-09-08 00:32:51 Re: [HACKERS] Rules: first fix