Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The integer primary key is not included in the information_schema.tidb_index_usage #58256

Closed
YangKeao opened this issue Dec 13, 2024 · 2 comments · Fixed by #58257
Closed

The integer primary key is not included in the information_schema.tidb_index_usage #58256

YangKeao opened this issue Dec 13, 2024 · 2 comments · Fixed by #58257
Labels
affects-8.5 This bug affects the 8.5.x(LTS) versions. severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@YangKeao
Copy link
Member

I recorded the index usage of clustered primary keys and integer primary keys in #55602, but when the primary key is an integer, it'll not show in the Index list of TableInfo, so it doesn't appear in the information_schema.tidb_index_usage table 🤦 .

My fault. The previous PR doesn't have any E2E test.

@YangKeao YangKeao added type/bug The issue is confirmed as a bug. sig/sql-infra SIG: SQL Infra severity/moderate affects-8.5 This bug affects the 8.5.x(LTS) versions. labels Dec 13, 2024
@YangKeao
Copy link
Member Author

I'll cherry-pick the fix to release-8.5, as this function doesn't work without this fix.

@YangKeao
Copy link
Member Author

Here is a simple reproduce:

CREATE TABLE t (pk INT PRIMARY KEY);

SELECT * FROM information_schema.tidb_index_usage WHERE table_schema = 'test';

The primary key is not included in it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-8.5 This bug affects the 8.5.x(LTS) versions. severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant