Bug #387 ERROR 1055: 'NULL' isn't in GROUP BY -- in ANSI mode
Submitted: 7 May 2003 6:02 Modified: 13 May 2003 9:16
Reporter: [ name withheld ] Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0.12 OS:pc-linux (i686)
Assigned to: Oleksandr Byelkin CPU Architecture:Any

[7 May 2003 6:02] [ name withheld ]
Description:
Executing a query like:

SELECT col,NULL FROM table GROUP BY col;

in ANSI mode (mysqld_safe ... --ansi), I've got this error:

ERROR 1055: 'NULL' isn't in GROUP BY

I don't know what the SQL Standard tell about this; I've just tried with Oracle
8 and it works.
So is it a bug?
Thanks in advance!

Regards,

Marco Guazzone

How to repeat:
CREATE TABLE foobar (
  id INT
);
SELECT id,NULL FROM foobar GROUP BY id;
DROP TABLE foobar;

Suggested fix:
Don't execute MySQL server in ANSI mode

or

change the query into:
  SELECT col,NULL FROM table GROUP BY col,NULL;
[13 May 2003 5:40] Oleksandr Byelkin
ChangeSet 
  1.1482 03/05/13 15:31:34 bell@sanja.is.com.ua
[13 May 2003 9:16] Michael Widenius
Thank you for your bug report. This issue has been fixed in the latest
development tree for that product. You can find more information about
accessing our development trees at 
    http://www.mysql.com/doc/en/Installing_source_tree.html