-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
affects-6.5This bug affects the 6.5.x(LTS) versions.This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.This bug affects the 8.1.x(LTS) versions.component/expressionseverity/majorsig/plannerSIG: PlannerSIG: Plannertype/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.
Description
Bug Report
Please answer these questions before submitting your issue. Thanks!
It actually has two issues:
- The result is not consistent with / without plan cache.
- The result is always not compatible with MySQL.
1. Minimal reproduce step (Required)
create table t (v varchar(16));
insert into t values ('156');
prepare stmt7 from 'select * from t where v = conv(?, 16, 8)';
set @arg=0x6E;
execute stmt7 using @arg;
execute stmt7 using @arg;
set @arg=0x70;
execute stmt7 using @arg;
2. What did you expect to see? (Required)
The result from MySQL is:
mysql> use test;
Database changed
mysql> create table t (v varchar(16));
Query OK, 0 rows affected (0.01 sec)
mysql> insert into t values ('156');
Query OK, 1 row affected (0.00 sec)
mysql> prepare stmt7 from 'select * from t where v = conv(?, 16, 8)';
Query OK, 0 rows affected (0.00 sec)
Statement prepared
mysql> set @arg=0x6E;
Query OK, 0 rows affected (0.00 sec)
mysql> execute stmt7 using @arg;
Empty set, 1 warning (0.00 sec)
mysql> execute stmt7 using @arg;
Empty set, 1 warning (0.00 sec)
mysql> set @arg=0x70;
Query OK, 0 rows affected (0.00 sec)
mysql> execute stmt7 using @arg;
Empty set, 1 warning (0.00 sec)
3. What did you see instead (Required)
The result from TiDB is:
mysql> create table t (v varchar(16));
Query OK, 0 rows affected (0.12 sec)
mysql> insert into t values ('156');
Query OK, 1 row affected (0.01 sec)
mysql> prepare stmt7 from 'select * from t where v = conv(?, 16, 8)';
Query OK, 0 rows affected (0.00 sec)
mysql> set @arg=0x6E;
Query OK, 0 rows affected (0.00 sec)
mysql> execute stmt7 using @arg;
+------+
| v |
+------+
| 156 |
+------+
1 row in set (0.00 sec)
mysql> execute stmt7 using @arg;
+------+
| v |
+------+
| 156 |
+------+
1 row in set (0.00 sec)
mysql> set @arg=0x70;
Query OK, 0 rows affected (0.00 sec)
mysql> execute stmt7 using @arg;
+------+
| v |
+------+
| 156 |
+------+
1 row in set (0.00 sec)
If you execute the second statement without using plan cache, it'll give nothing:
mysql> create table t (v varchar(16));
Query OK, 0 rows affected (0.11 sec)
mysql> insert into t values ('156');
Query OK, 1 row affected (0.01 sec)
mysql> prepare stmt7 from 'select * from t where v = conv(?, 16, 8)';
Query OK, 0 rows affected (0.00 sec)
mysql> set @arg=0x70;
Query OK, 0 rows affected (0.00 sec)
mysql> execute stmt7 using @arg;
Empty set (0.01 sec)
4. What is your TiDB version? (Required)
Metadata
Metadata
Assignees
Labels
affects-6.5This bug affects the 6.5.x(LTS) versions.This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.This bug affects the 8.1.x(LTS) versions.component/expressionseverity/majorsig/plannerSIG: PlannerSIG: Plannertype/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.