SHOW INDEX on a sequence fails with SELECT command denied, even for root (v8.5.6+)
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- backend-api-design, database
Research direction
The issue identifies pkg/executor/show.go and fetchShowIndex as the affected code. Read that function and the privilege checks for SHOW INDEX, then reproduce the reported sequence case on TiDB v8.5.6 or later. Done means SHOW INDEX FROM s returns an empty result for a sequence, while privilege checks for tables with columns continue to work.
Written by the indexing model from the issue text.
Description
Bug Report
1. Minimal reproduce step (Required)
Start a TiDB v8.5.6 or later cluster (e.g. tiup playground v8.5.8) and run as root:
CREATE DATABASE t;
USE t;
CREATE SEQUENCE s;
SHOW INDEX FROM s;
2. What did you expect to see? (Required)
TiDB v8.5.5:
mysql> SHOW INDEX FROM s;
Empty set (0.002 sec)
MariaDB 13.0.2:
MariaDB> SHOW INDEX FROM s;
Empty set (0.000 sec)
An empty result set, as in TiDB v8.5.5 and earlier (v8.1.2, v8.2.0–v8.4.0, v8.5.0, v8.5.4, v8.5.5 were checked). MariaDB 13.0.2 also returns an empty result for SHOW INDEX FROM <sequence> to a user who has privileges on it, and an access-denied error only to a user without privileges.
3. What did you see instead (Required)
mysql> SHOW INDEX FROM s;
ERROR 1142 (42000): SELECT command denied to user 'root'@'%' for table 's'
A non-root user granted SELECT ON t.s gets the same error. SHOW COLUMNS FROM s and SHOW INDEX FROM <view> still return an empty result.
This appears to come from #66535 (backport of #61679), which changed fetchShowIndex in pkg/executor/show.go to pass the privilege check only if the user has a privilege on at least one of tb.VisibleCols(). A sequence has no columns, so the loop never runs, passCheck stays false, and every user, including root, is denied. master still checks table-level privileges and is not affected.
Impact: Rails' schema cache (activerecord-tidb-adapter) runs SHOW KEYS on every data source listed in information_schema.tables, including sequences. On v8.5.6+ this fails with the error above (worked around in pingcap/activerecord-tidb-adapter#75).
4. What is your TiDB version? (Required)
Release Version: v8.5.8
Edition: Community
Git Commit Hash: 8b857efa20363d50a8fa2ea7dd9809a85a61b115
Git Branch: HEAD
UTC Build Time: 2026-08-27 07:18:32
Store: tikv
First affected release: v8.5.6.
- Dominant language
- Go
- Stars
- 40.7k
- Forks
- 6.3k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 291
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pingcap/tidb
-
affects-8.5 component/session severity/moderate sig/transaction type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
INTERVAL() over nullable INT columns uses binary search because builtinIntervalIntSig.Clone drops hasNullablePossibly taken @linzch3 claimed this 1 day ago. Opencontribution
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
pingcap/tidb#73150 · 2 comments ·
Maintainers usually reply within 1 day
-
SUBDATE with a DECIMAL date argument larger than int64 fails with error 1690 in TiDB but yields a warning and NULL in TiKVMay be free again A pull request for this issue was closed without being merged. Opencontribution
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
DATE_ADD with an INTERVAL string ending in U+00A0: TiDB accepts it, TiKV coprocessor fails with 'Data Truncated' (error 1105) under strict modeMay be free again A pull request for this issue was closed without being merged. Opencontribution
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Vectorized ILIKE swallows an error raised while evaluating a constant ESCAPE argument, row-based evaluation reports itPossibly taken @gaurav0107 claimed this 11 days ago. Opencontribution
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
Similar issues
-
Pin and verify Security Insights schema in lintinsights targetPossibly taken @imshubham22apr-gif claimed this 5 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
gemaraproj/gemara#618 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
a2aproject/a2a-go#597 ·
Maintainers usually reply within 1 day
-
scopes: GetAllowedTopics, GetProtectedTopics, and GetScopedTopics include empty topic names and do not trim whitespace charactersPossibly taken @patelshivani2283-lab claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
area/networking kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
siderolabs/talos#14972 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
Maintainers usually reply within 1 day