Repository navigation
Description
Description
SHOW INDEX and SHOW COLUMNS fail with an internal SQL syntax error for valid backtick-quoted identifiers containing an apostrophe. The tables and columns are accepted by DDL, remain readable, and SHOW CREATE TABLE works. This affects planner-side SHOW rewrites, distinct from the frontend SHOW TABLE STATUS path reported in #30545.
Environment
- Branch: official
main - Commit:
75ff736835c3d00d40dc00a0a1d3b11129388e5b - Deployment: macOS arm64; locally built
mo-service, isolated single-process LOG/TN/CN with a fresh data directory; SQL frontend on an isolated loopback port; 2026-10-19.
Steps to reproduce
CREATE DATABASE exp_show_quoted;
USE exp_show_quoted;
CREATE TABLE plain (id INT PRIMARY KEY, v INT, INDEX ix_v(v));
CREATE TABLE `a'b` (id INT PRIMARY KEY, v INT, INDEX ix_v(v));
CREATE TABLE quote_col (id INT PRIMARY KEY, `x'y` INT, INDEX ix_x(`x'y`));
INSERT INTO plain VALUES (1,11);
INSERT INTO `a'b` VALUES (2,22);
INSERT INTO quote_col VALUES (3,33);
SHOW CREATE TABLE `a'b`; -- succeeds
SHOW INDEX FROM plain; -- succeeds; PRIMARY and ix_v
SHOW INDEX FROM `a'b`; -- ERROR 1105/HY000
SHOW COLUMNS FROM plain; -- succeeds; id and v
SHOW COLUMNS FROM `a'b`; -- ERROR 1105/HY000
SHOW COLUMNS FROM quote_col; -- ERROR 1105/HY000
SHOW INDEX FROM quote_col; -- succeeds; PRIMARY and ix_x
SELECT id,v FROM `a'b` WHERE id=2; -- (2,22)
SELECT id,`x'y` FROM quote_col WHERE id=3; -- (3,33)Actual behavior
SHOW INDEX FROMa'b`` returnsERROR 1105 (HY000), syntax error near `b' as `Table` ...` in an internally generated SELECT.SHOW COLUMNS FROMa'b`` returnsERROR 1105 (HY000), syntax error near `b' AND ...`.SHOW COLUMNS FROM quote_colreturnsERROR 1105 (HY000), syntax error neary' then 'MUL' ....- The three source rows remain readable after the errors; no failed SHOW changes table data.
Expected behavior
These valid identifiers should yield their index/column metadata, just like the corresponding ordinary-name controls. MySQL's identifier rules allow apostrophes inside backtick-quoted identifiers, and MatrixOne itself accepts and reads these objects.
Stability and controls
- Reproducer: 3/3 independent fresh databases, each with the exact three failures above.
- Passing controls:
SHOW CREATE TABLEa'b``,SHOW INDEX FROM plain, `SHOW COLUMNS FROM plain`, and `SHOW INDEX FROM quote_col` succeed in each run. - Post-error check:
SELECTon quoted table and quoted column returns the inserted row in each run; the connection remains usable.
Evidence
The SQL file and exact client output are preserved in the local isolated run directory as show_quoted_metadata.sql and the corresponding run transcript. The SQL above is the minimal public reproducer; no customer data or credentials are involved.
Code analysis
pkg/sql/plan/build_show.go constructs internal SELECTs by placing parsed names directly into single-quoted SQL literals:
buildShowIndexaround lines 1030-1093: both the displayed table name and catalog table predicate are passed raw tofmt.Sprintf.buildShowColumnsaround lines 680-773: the catalog table predicate andCASE WHEN col.attname = '...'fragments for indexed columns use raw names.
The resulting internal SQL is malformed when the valid identifier contains '. This is a planner SHOW-rewrite defect; #30545 instead concerns SHOW TABLE STATUS interpolation in pkg/frontend/mysql_cmd_executor.go.
Regression coverage
After a fix, add a metadata SHOW regression covering quoted table and indexed-column names, normal names, and connection/data preservation after errors. No repository test or PR was added in this exploration pass.
Related
- [Bug]: SHOW metadata must report valid table columns and identifiers accurately #30545: distinct frontend path,
SHOW TABLE STATUSon the same identifier class. - Existing open/closed issue searches for
SHOW INDEX/SHOW COLUMNSwith quoted identifiers found no matching issue. The MySQL compatibility contract has no exclusion for these supported SHOW operations.
Activity
XuPeng-SH commentedon Oct 22, 2026
This report is now tracked together with #30545. The canonical issue retains explicit acceptance cases for the behavior described here. This is an administrative duplicate/consolidation closure only; the underlying defect is not claimed fixed. The original description and discussion remain available on this issue.