thswlsqls opened a new issue, #39849: URL: https://github.com/apache/shardingsphere/issues/39849
## Bug Report ### Which version of ShardingSphere did you use? master @ 101c3d56ccd ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy? Both ### Expected behavior `SHOW INDEX FROM <non-sharding table>` returns the stored `Key_name`; ShardingSphere never rewrites index names of single or broadcast tables. ### Actual behavior An index name ending with `_<table name>` loses the suffix: `uk_t_config` on `t_config` is shown as `uk`, while `SHOW CREATE TABLE t_config` still shows `uk_t_config`. ### Reason analyze (If you can) `MySQLShardingShowIndexMergedResult.init()` (`features/sharding/dialect/mysql`, line 55-62) applies `IndexMetaDataUtils.findGeneratedLogicIndexName()` to every row. For non-sharding rows the candidate list is empty, so the exact-candidate protection from #38449 never applies and the suffix is treated as generated. Non-sharding tables have no generated index names since #31173; `IndexToken` and the sibling `MySQLShardingShowCreateTableMergedResult` leave them untouched. ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc. 1. Configure a sharding rule for `t_order`; keep `t_config` as a single table. 2. `CREATE TABLE t_config (id INT PRIMARY KEY, code VARCHAR(32), UNIQUE KEY uk_t_config (code));` 3. `SHOW INDEX FROM t_config;` Expected `Key_name`: `PRIMARY`, `uk_t_config`. Actual: `PRIMARY`, `uk`. ### Example codes for reproduce this issue (such as a github link). N/A -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
