From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | The Hermit Hacker <scrappy(at)hub(dot)org> |
Cc: | pgsql-hackers(at)postgreSQL(dot)org, Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us> |
Subject: | Re: [HACKERS] Re: [GENERAL] Re: [PHP3] Re: PostgreSQL vs Mysql comparison |
Date: | 1999-10-05 14:46:31 |
Message-ID: | 10982.939134791@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
The Hermit Hacker <scrappy(at)hub(dot)org> writes:
> Anyone want to comment on this one? Just tested with v6.5.0 and it still
> exists there...
> vhosts=> create table test ( a int, b char );
> CREATE
> vhosts=> insert into test values ( 1, 'a' );
> INSERT 149258 1
> vhosts=> select a from test group by a having a > 0;
> ERROR: SELECT/HAVING requires aggregates to be valid
That's not a bug, it means what it says: HAVING clauses should contain
aggregate functions. Otherwise they might as well be WHERE clauses.
(In this example, flushing rows with negative a before the group step,
rather than after, is obviously a win, not least because it would
allow the use of an index on a.)
However, I can't see anything in the SQL92 spec that requires you to
use HAVING intelligently, so maybe this error should be downgraded to
a notice? "HAVING with no aggregates would be faster as a WHERE"
(but we'll do it anyway to satisfy pedants...)
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Oleg Bartunov | 1999-10-05 14:58:00 | 6.5.2 vacuum NOTICE messages |
Previous Message | Tom Lane | 1999-10-05 14:08:16 | Re: [HACKERS] Planner drops unreferenced tables --- bug, no? |