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.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.