-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
incompatible query result with MySQL #14399
Comments
@qw4990 Should this issue be assigned to expression SIG? |
This behaves different in MySQL 5.7 / MySQL 8.0 / TiDB. I am not smart enough to figure out which one is most correct :( Testcase: drop table if exists t;
create table t(col_double double);
insert into t values(1);
prepare stmt from "SELECT * FROM (SELECT col_double AS c0 FROM t) t WHERE (ABS((REPEAT(?, ?) OR 5617780767323292672)) < LN(EXP(c0)) + (? ^ ?))";
SET @a1 = "JuvkBX7ykVux20zQlkwDK2DFelgn7", @a2 = 1, @a3 = -112990.35179796701, @a4 = 87997.92704840179;
execute stmt using @a1, @a2, @a3, @a4; MySQL 5.7: mysql [localhost:5731] {msandbox} (test) > execute stmt using @a1, @a2, @a3, @a4;
Empty set (0.00 sec) MySQL 8.0: mysql [localhost:8021] {msandbox} (test) > execute stmt using @a1, @a2, @a3, @a4;
+------+
| c0 |
+------+
| 1 |
+------+
1 row in set (0.00 sec) TiDB (master): mysql> execute stmt using @a1, @a2, @a3, @a4;
+------+
| c0 |
+------+
| 1 |
+------+
1 row in set, 23 warnings (0.01 sec) |
Simplified testcase:
MySQL 5.6 result:
MySQL 8.0 result:
"0 < (col_double + (-1 ^ 8))": result of this expression should be true. TiDB's result is OK. Implementation of MySQL 5.6 got bug, because it didn't convert the result of "-1 ^ 8" to unsigned longlong(see Item_cache_int::val_real(), it shoud check Item::unsigned_flag, then convert value to unsigned, just like Item_int_func::val_real() does.) Maybe we can close this issue? |
Bug Report
Please answer these questions before submitting your issue. Thanks!
In MySQL:
Different result for
execute
.tidb-server -V
or runselect tidb_version();
on TiDB)?The text was updated successfully, but these errors were encountered: