MySQL SHOW INDEX merge strips table suffix from index names of non-sharding tables

Author: thswlsqlsCreated Sep 17, 2026Updated Sep 17, 2026

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