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

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Christopher Kings-Lynne <chriskl@familyhealth.com.au>
Cc: Kevin Brown <kevin@sysexperts.com>, pgsql-hackers@postgresql.org
Date: 2005-03-10T04:44:55Z
Lists: pgsql-bugs, pgsql-hackers
Christopher Kings-Lynne <chriskl@familyhealth.com.au> writes:
>>> Comments?  Can anyone confirm whether DB2 or other databases allow
>>> ungrouped column references with HAVING?

> MySQL allows it:

A slightly tighter experiment shows that they treat HAVING like WHERE
in this case:

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

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

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

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

I think it's fairly likely that they copied our misinterpretation ...

			regards, tom lane