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

Querying stats_extended reports syntax error #23396

Open
djshow832 opened this issue Mar 18, 2021 · 1 comment
Open

Querying stats_extended reports syntax error #23396

djshow832 opened this issue Mar 18, 2021 · 1 comment
Labels
severity/minor sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@djshow832
Copy link
Contributor

Bug Report

Selecting stats_extended reports syntax error, and I have to add quotes for it:

select * from `stats_extended`;

Is stats_extended implemented as a keyword in show stats_extended? It doesn't make sense because other stats tables are fine, such as select * from stats_histograms.

1. Minimal reproduce step (Required)

select * from stats_extended limit 1;

2. What did you expect to see? (Required)

It outputs something.

3. What did you see instead (Required)

mysql> select * from stats_extended limit 1\G
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 28 near "stats_extended limit 1"

4. What is your TiDB version? (Required)

master

@djshow832 djshow832 added type/bug The issue is confirmed as a bug. sig/planner SIG: Planner component/parser severity/minor labels Mar 18, 2021
@jebter jebter added this to the v5.0.0 ga milestone Mar 22, 2021
@zimulala zimulala removed this from the v5.0.0 ga milestone Mar 23, 2021
@eurekaka
Copy link
Contributor

This is because stats_extended is marked as a reserved keyword now, while stats_histograms is marked as tidb keyword. The rationale behind this difference is to support the syntax like alter table t add stats_extended s1 ..., if stats_extended is not marked as a reserved keyword, the parser cannot know it is a keyword or a column name, since alter table t add [column] a ... is supported as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/minor sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

5 participants