pingcap / pingcap/tidb

After Rename Table, show Global Bindings cannot be viewed

Open
#38,196 1 comment 0 reactions 1 assignee Claimed by @xuyifangreeneyes View on GitHub
affects-6.4 affects-6.5 affects-6.6 may-affects-4.0 may-affects-5.0 may-affects-5.1 may-affects-5.2 may-affects-5.3 may-affects-5.4 may-affects-6.0 may-affects-6.1 may-affects-6.2 may-affects-6.3 severity/moderate sig/planner type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

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: 094b3e5e69d0921e2abe6907d217478bb5a7082d
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)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.