Skip to content

After Rename Table, show Global Bindings cannot be viewed #38196

Open
@bob34007

Description

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

--create table
create table testb (id int primary key ,name varchar(200));
alter table testb add index idx1(id,name);
--create binding
create global binding for select * from test.testb using select * from test.testb use index(idx1) ;
rename table testb to testb1;
--restart cluster
tiup cluster restart tidb -y
--show global bindings
show global bindings;

2. What did you expect to see? (Required)

mysql> show global bindings;
+--------------------------------+-------------------------------------------------+------------+--------+-------------------------+-------------------------+---------+-----------------+--------+
| Original_sql | Bind_sql | Default_db | Status | Create_time | Update_time | Charset | Collation | Source |
+--------------------------------+-------------------------------------------------+------------+--------+-------------------------+-------------------------+---------+-----------------+--------+
| select * from test . testb | SELECT * FROM test.testb USE INDEX (idx1) | | using | 2022-09-27 15:27:31.003 | 2022-09-27 15:27:31.003 | utf8 | utf8_general_ci | manual |
+--------------------------------+-------------------------------------------------+------------+--------+-------------------------+-------------------------+---------+-----------------+--------+
1 row in set (0.00 sec)

3. What did you see instead (Required)

mysql> show global bindings;
Empty set (0.00 sec)

4. What is your TiDB version? (Required)

mysql> select tidb_version();
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v5.1.4
Edition: Community
Git Commit Hash: 094b3e5
Git Branch: heads/refs/tags/v5.1.4
UTC Build Time: 2022-02-10 10:03:53
GoVersion: go1.16.4
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions