Re: [HACKERS] Re: [GENERAL] Re: [PHP3] Re: PostgreSQL vs Mysql comparison - Mailing list pgsql-hackers

From Thomas Lockhart
Subject Re: [HACKERS] Re: [GENERAL] Re: [PHP3] Re: PostgreSQL vs Mysql comparison
Date
Msg-id 37FA043E.E8ABA442@alumni.caltech.edu
Whole thread Raw
In response to Re: [GENERAL] Re: [PHP3] Re: PostgreSQL vs Mysql comparison  (The Hermit Hacker <scrappy@hub.org>)
List pgsql-hackers
> 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

Oh, don't get me started again on crashme :(

What is the purpose of the previous query? It seems to be equivalent
to
 select distinct a where a > 0;

We do support the HAVING clause, but apparently disallow some
degenerate cases. If MySQL weren't just a toy db, perhaps they would
start putting real queries into their garbage crashme. There, I feel
better now ;)

postgres=> select b, avg(a) from test group by b having avg(a) > 0;
b|avg
-+---
a|  1
(1 row)
                        - Thomas

-- 
Thomas Lockhart                lockhart@alumni.caltech.edu
South Pasadena, California


pgsql-hackers by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: [HACKERS] How to add a new build-in operator
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Planner drops unreferenced tables --- bug, no?