Re: We are not following the spec for HAVING without GROUP

From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Kevin Brown <kevin(at)sysexperts(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: We are not following the spec for HAVING without GROUP
Date: 2005-03-10 04:00:26
Message-ID: 422FC65A.5060806@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

>>Comments? Can anyone confirm whether DB2 or other databases allow
>>ungrouped column references with HAVING?
>
> Oracle does not allow such references. It issues "ORA-00979: not a
> GROUP BY expression" when you try to hand it such a reference.
>
> MS SQL Server does not allow such references either, yielding
> "columnname is invalid in the HAVING clause because it is not
> contained in either an aggregate function or the GROUP BY clause.".
>
> Can't comment about DB2.

MySQL allows it:

mysql> create table tab (col integer);
Query OK, 0 rows affected (0.01 sec)

mysql> select col from tab having 2 > 1;
Empty set (0.00 sec)

mysql> insert into tab values (1);
Query OK, 1 row affected (0.00 sec)

mysql> select col from tab having 2 > 1;
+------+
| col |
+------+
| 1 |
+------+
1 row in set (0.00 sec)

Of course, that's not saying much!

Chris

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2005-03-10 04:44:55 Re: We are not following the spec for HAVING without GROUP
Previous Message Greg Stark 2005-03-10 03:46:26 Re: We are not following the spec for HAVING without GROUP BY

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2005-03-10 04:23:07 Information schema tweak?
Previous Message Greg Stark 2005-03-10 03:53:08 Re: fool-toleranced optimizer