You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: FLOAT/DOUBLE arithmetic and comparison with a BOOL operand fail with 'bad value [DOUBLE BOOL]' #31292
Arithmetic and comparison between a FLOAT/DOUBLE and a BOOL fail to bind:
mysql> select 1e0 + true;
ERROR 20203 (HY000): invalid argument operator +, bad value [DOUBLE BOOL]
mysql> select cast(1.5 as float) + true;
ERROR 20203 (HY000): invalid argument operator +, bad value [FLOAT BOOL]
mysql> select * from t where d > b; -- d DOUBLE, b BOOL
ERROR 20203 (HY000): invalid argument operator >, bad value [DOUBLE BOOL]
The same happens for -, *, /, %, DIV, =, <>, <, <=, >, >=, <=>, in either operand order, and for NULLIF(1e0, TRUE) (lowered to =).
MySQL treats TRUE/FALSE as the integers 1/0, so these evaluate as DOUBLE: 1e0 + TRUE = 2, 3e0 / TRUE = 3, 5e0 % TRUE = 0, 5e0 DIV TRUE = 5, 1e0 = TRUE = 1. MatrixOne already does this for integers (2 + true = 3).
Cause: fixedBinaryCastRule1 / fixedBinaryCastRule2 (type_check.go) have BOOL × INT*/UINT* rows but no BOOL × FLOAT32/FLOAT64 rows. BOOL → FLOAT casts already exist (boolToFloat).
Related: #31181 / #31193 fix the same gap for DECIMAL × BOOL.
How to reproduce
select 1e0 + true, 3e0 / true, 5e0 % true, 5e0 div true, 1e0 = true, true < 2e0;
createtabletf(f float, d double, b bool);
insert into tf values (1.5, 2.5, true), (0, 0, false), (null, null, null);
select f + b, d - b, d * b, f = b, d > b from tf;
select*from tf where d > b;
select nullif(1e0, true), nullif(2e0, true);
QA handoff for merged #31296 at bc168358728aaa8141ae7a3c9d8f27bb8cb33e75. This round reviewed the issue and change only; no build or functional test ran at this SHA because the existing memory guard was exceeded. Author-reported tests are separate evidence.
Please verify FLOAT/DOUBLE with BOOL in both operand orders across arithmetic and comparisons, NULL, division/error controls and prepared execution. This handoff does not claim a pass.
Activity
fix(function): treat BOOL as 1/0 next to FLOAT/DOUBLE in arithmetic a…
XuPeng-SH commentedon Oct 30, 2026
QA handoff for merged #31296 at
bc168358728aaa8141ae7a3c9d8f27bb8cb33e75. This round reviewed the issue and change only; no build or functional test ran at this SHA because the existing memory guard was exceeded. Author-reported tests are separate evidence.Please verify FLOAT/DOUBLE with BOOL in both operand orders across arithmetic and comparisons, NULL, division/error controls and prepared execution. This handoff does not claim a pass.
Ariznawlll commentedon Oct 31, 2026
结论
测试通过。
关键证据
main@4f894474ad10e1b9dc338868145a118a71c1fa23,修复 fix(function): treat BOOL as 1/0 next to FLOAT/DOUBLE in arithmetic and comparison #31296 在祖先链。issue_31292_31295_bool_numeric.py(提交3fcb79e5);该 PR 尚未合入,完整 suite 未运行。待解决点