Bug #41365 inconsistent restriction on whitespace in SQL for aggregates
Submitted: 10 Dec 2008 17:39 Modified: 10 Dec 2008 17:57
Reporter: Shane Harrelson Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:mysql-essential-5.1.30-win32.msi OS:Microsoft Windows (XP SP2)
Assigned to: CPU Architecture:Any
Tags: aggregates, whitespace
Triage: Triaged: D4 (Minor)

[10 Dec 2008 17:39] Shane Harrelson
Description:
Inconsistent restriction on whitespace in SQL for aggregates.

How to repeat:
These both work:
  AVG( col1 ) 
  AVG ( col1 ) 
This does not:
  MIN ( col1 ) 
It has to be written:
  MIN( col1 ) 
Note that the whitespace before the '(' has been removed.
[10 Dec 2008 17:57] Valeriy Kravchuk
Indeed, this is inconsistent and thus a bug. But there is a nice workaround:

mysql> select max (col1) from tab0;
ERROR 1305 (42000): FUNCTION test.max does not exist
mysql> set sql_mode='IGNORE_SPACE';
Query OK, 0 rows affected (0.00 sec)

mysql> select max (col1) from tab0;
+------------+
| max (col1) |
+------------+
|         44 |
+------------+
1 row in set (0.03 sec)

We have IGNORE_SPACE SQL mode for cases like this.
[18 May 2010 22:40] Hartmut Holzgraefe
Any good reason for AVG_SYM being in the symbols[] array in sql/lex.h while MIN_SYM is in the sql_functions array?