Bug #25173 incorrect example
Submitted: 19 Dec 2006 11:54 Modified: 20 Dec 2006 11:23
Reporter: Naresh Gupta Email Updates:
Status: Not a Bug Impact on me:
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.0 OS:
Assigned to: CPU Architecture:Any

[19 Dec 2006 11:54] Naresh Gupta
in the reference manual, in the following section 

B.5.3. Problems with NULL Values

for the last example, 

MySQL>select ifnull(null,10)

|              1|  
1 row in set (0.00 sec)

the mysql returns value should be 10 and not 1.

How to repeat:
reading the relevant section

Suggested fix:
Just change the value from 1 to 10.
[19 Dec 2006 13:11] MySQL Verification Team
Thank you for the bug report. I was unable to find in the online Manual:

The only place I found is:


and it is correct:


If expr1 is not NULL, IFNULL() returns expr1; otherwise it returns expr2. IFNULL() returns a numeric or string value, depending on the context in which it is used.

mysql> SELECT IFNULL(1,0);
        -> 1
        -> 10
mysql> SELECT IFNULL(1/0,10);
        -> 10

Could you please point to the exactly URL you found it. Thanks in advance.
[20 Dec 2006 11:16] Naresh Gupta
It is the same url that you have mentioned:


Scroll down at the bottom of the page, the very last example/lines are the place I was talking about.
[20 Dec 2006 11:23] MySQL Verification Team
Thank you for the feedback. That is User Comments not Manual Example
maybe that user got that result with a bug at that time.