Bug #115902 Inconsistent Results When Using IFNULL
Submitted: 22 Aug 12:37 Modified: 22 Aug 12:54
Reporter: Wenqian Deng Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Data Types Severity:S3 (Non-critical)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any

[22 Aug 12:37] Wenqian Deng
Description:
There is an inconsistency in the results when using the IFNULL function.

How to repeat:
1. Set up table t0:

CREATE TABLE t0 (c0 BIT, c1 BIT);
INSERT INTO t0 VALUES (0, 1);

2. Use IFNULL in a SELECT query:

SELECT (IFNULL(t0.c0, t0.c1)) FROM t0;
--Result: 0x30

3. Store the result of COALESCE in another table t1 and SELECT FROM t1:

CREATE TABLE t1 AS (SELECT (IFNULL(t0.c0, t0.c1)) AS c0 FROM t0);
SELECT * FROM t1;
--Result: 0x00

The result should be consistent regardless of whether the result is directly selected or stored in another table.
[22 Aug 12:54] MySQL Verification Team
Hi Mr. Deng,

Thank you for your bug report.

Seems that all MySQL functions that deal with NULL have the same bug.

We are now extending bug #115893 to encompass all those functions .......

We are updating our internal bug system to reflect all these functions.

Thank you ........

Thank you .......