Open
Description
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
create table t (d datetime);
create global binding for
select hour(`d`) as `hour` from t group by `hour`
using
select hour(`d`) as `hour` from t group by `hour`;
select hour(`d`) as `hour` from t group by `hour`;
select @@last_plan_from_binding;
prepare st from "select hour(`d`) as `hour` from t group by `hour`";
execute st;
select @@last_plan_from_binding;
2. What did you expect to see? (Required)
Both the normal query and the prepared statement can use the global binding.
3. What did you see instead (Required)
mysql> select hour(`d`) as `hour` from t group by `hour`;
Empty set (0.00 sec)
mysql> select @@last_plan_from_binding;
+--------------------------+
| @@last_plan_from_binding |
+--------------------------+
| 1 |
+--------------------------+
1 row in set (0.00 sec)
mysql>
mysql> prepare st from "select hour(`d`) as `hour` from t group by `hour`";
Query OK, 0 rows affected (0.00 sec)
mysql> execute st;
Empty set (0.00 sec)
mysql> select @@last_plan_from_binding;
+--------------------------+
| @@last_plan_from_binding |
+--------------------------+
| 0 |
+--------------------------+
1 row in set (0.01 sec)
4. What is your TiDB version? (Required)
Master
Activity