Bug #108635 MySQL parser: cannot support index_type in create index statement index option
Submitted: 28 Sep 2022 14:28 Modified: 29 Sep 2022 11:57
Reporter: Adrian Lin Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Parser Severity:S3 (Non-critical)
Version: OS:MacOS
Assigned to: CPU Architecture:ARM (M1)

[28 Sep 2022 14:28] Adrian Lin
Description:
I try to execute `CREATE INDEX ON book(name) USING BTREE COMMENT 'no difference!';` on MySQL server 8.0.29 which runs in Docker Desktop.
But it reports an error:
(1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'on book(name) USING BTREE COMMENT 'no difference!'' at line 1")
This `CREATE INDEX` statement documentation https://dev.mysql.com/doc/refman/8.0/en/create-index.html claims that it support using `index_type` in `index_option`.

How to repeat:
Execute the following statement in MySQL community server 8.0.29:
CREATE TABLE book(name VARCHAR(50));
CREATE INDEX ON book(name) USING BTREE COMMENT 'no difference!';
[29 Sep 2022 11:57] MySQL Verification Team
Hi Mr. Lin,

Thank you for your bug report.

However, it is not a bug.

You simply have a syntax error in your CREATE INDEX command. The sequencing of your syntax is simply wrong. It is all explained in our Reference Manual.

Not a bug.