Bug #7069 SQL IF syntax compared with syntax of GROUP functions
Submitted: 7 Dec 2004 11:10 Modified: 7 Dec 2004 17:12
Reporter: Thomas Keller Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:3.23.56 OS:Linux (Redhat 9)
Assigned to: CPU Architecture:Any

[7 Dec 2004 11:10] Thomas Keller
Description:
I haven't checked this behaviour in newer releases but I noticed it in 3.23.56:

A

SELECT SUM(1)

is correctly parsed without errors, while a

SELECT SUM (1)

puts out a compile error.

Now following this behaviour why are

SELECT IF(1,2,3) 

and

SELECT IF (1,2,3)

are both valid? Shouldn't be there one behaviour, like generally allowing/ disallowing spaces between the function's name and the opening bracket?

How to repeat:
SELECT SUM(1)
SELECT SUM (1)  -- error
SELECT IF(1,2,3) 
SELECT IF (1,2,3)  -- no error
[7 Dec 2004 17:12] MySQL Verification Team
This is not a bug.

It is not a bug, because SUM() is used ONLY as a function, while IF has other, non-functional lexical usage, like in " ... IF (NOT) EXISTS".

That is why IF can not be treated as a functional only symbol.