| Bug #120523 | Wrong result for arithmetic expression involving DAYNAME() and BIT column | ||
|---|---|---|---|
| Submitted: | 22 May 9:13 | Modified: | 25 May 20:10 |
| Reporter: | ss w | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
| Version: | 8.0.43 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[25 May 20:10]
Roy Lyseng
Thank you for the bug report. Verified as described.

Description: A query using an arithmetic expression involving DAYNAME() and a BIT column may evaluate inconsistently between WHERE filtering and direct SELECT expression evaluation. In this case, the expression multiplies the string result returned by DAYNAME() with a BIT value. The WHERE query correctly evaluates the expression as FALSE and returns an empty result set, while direct SELECT expression evaluation incorrectly treats the same expression as TRUE. How to repeat: CREATE TABLE t1611 (c1 BIT); INSERT INTO t1611 (c1) VALUES (b'1'); SELECT t1611.c1 FROM t1611 WHERE (DAYNAME('2005-11-19 12:30:27') * t1611.c1); -- return 0 rows SELECT SUM(count) FROM (SELECT (DAYNAME('2005-11-19 12:30:27') * t1611.c1) IS TRUE AS count FROM t1611) AS ta_norec; -- return 1