Bug #116163 | COALESCE(BIT), IF(BIT) return a wrong result | ||
---|---|---|---|
Submitted: | 19 Sep 2024 14:08 | Modified: | 24 Sep 2024 12:36 |
Reporter: | Guilhem Bichot | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S2 (Serious) |
Version: | 9.0 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[19 Sep 2024 14:08]
Guilhem Bichot
[19 Sep 2024 14:31]
MySQL Verification Team
Hello Guilhem, Thank you for the report and test case. regards, Umesh
[19 Sep 2024 14:50]
Guilhem Bichot
IF() is also affected, if using a BIT(32) column (observed no problem with BIT(8)). Example: CREATE TABLE t1 (c0 bit(32)); insert into t1 values(0x00AABBCC); select hex(c0), c0, coalesce(c0), coalesce(c0,c0), ifnull(c0,c0), if(1=1,c0,c0) from t1; +---------+------------+----------------------------+----------------------------------+------------------------------+------------------------------+ | hex(c0) | c0 | coalesce(c0) | coalesce(c0,c0) | ifnull(c0,c0) | if(1=1,c0,c0) | +---------+------------+----------------------------+----------------------------------+------------------------------+------------------------------+ | AABBCC | 0x00AABBCC | 0x3131313839313936 | 0x3131313839313936 | 0x3131313839313936 | 0x00C2AAC2BBC38C | +---------+------------+----------------------------+----------------------------------+------------------------------+------------------------------+ The last column, IF(), should return the value of c0 but it does not (and it's differently from wrong from the wrong value of COALESCE).
[24 Sep 2024 12:36]
Guilhem Bichot
GROUP_CONCAT, with the same table as above: +select group_concat(c0),group_concat(c0 order by 1+1) from t0; +group_concat(c0) group_concat(c0 order by 1+1) +A,B 66,65 (this is from a mtr test) We see that the addition of ORDER BY makes GROUP_CONCAT use numeric values (66,65) ; without it, it uses characters having these ASCII codes. FWIW it happens identically with ORDER BY BINARY ''. I doubt this behaviour is intentional.