Skip to content

[Bug]: SHOW INDEX and SHOW COLUMNS fail for quoted table or indexed-column names #30549

Closed as not planned

Description

@Ariznawlll

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 FROM a'b`` returns ERROR 1105 (HY000), syntax error near `b' as `Table` ...` in an internally generated SELECT.
  • SHOW COLUMNS FROM a'b`` returns ERROR 1105 (HY000), syntax error near `b' AND ...`.
  • SHOW COLUMNS FROM quote_col returns ERROR 1105 (HY000), syntax error near y' 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 TABLE a'b``, SHOW INDEX FROM plain, `SHOW COLUMNS FROM plain`, and `SHOW INDEX FROM quote_col` succeed in each run.
  • Post-error check: SELECT on 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:

  • buildShowIndex around lines 1030-1093: both the displayed table name and catalog table predicate are passed raw to fmt.Sprintf.
  • buildShowColumns around lines 680-773: the catalog table predicate and CASE 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

Activity

  1. added this to the MO-202610 milestone on Oct 19, 2026
  2. added
    kind/bug
    on Oct 19, 2026
  3. added theissue type on Oct 19, 2026
  4. XuPeng-SH commented on Oct 22, 2026

    @XuPeng-SH
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions