Bug #78207 create table whose primary key had an identifier shouldn't be allowed
Submitted: 25 Aug 2015 11:13 Modified: 25 Aug 2015 18:05
Reporter: July July Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DDL Severity:S3 (Non-critical)
Version:5.6.22 MySQL Community Server (GPL) OS:Any
Assigned to: CPU Architecture:Any

[25 Aug 2015 11:13] July July
Description:
I have seen a create table whose primary key had an identifier where it should have an index_type, something like that:

CREATE TABLE `t1` (   `a2` int(11) NOT NULL DEFAULT '0',PRIMARY KEY test (`a2`));

The thing is that according to documentation it shouldn't be allowed, as where test is should be, if something, an index_type (USING {BTREE | HASH}).

How to repeat:
drop table if exists t1; 
CREATE TABLE `t1` (   `a2` int(11) NOT NULL DEFAULT '0',PRIMARY KEY test (`a2`));
[25 Aug 2015 18:05] MySQL Verification Team
You are correct regarding naming the primary key. However, there is a restriction that it works for create_definition, and not for column_definition.

It is an extension to SQL Standard, but it needs to be documented, for which reason I am verifying the bug.
[25 Aug 2015 18:12] MySQL Verification Team
This turns out to be a bug, hence a category is changed.
[26 Aug 2020 10:52] Jon Stephens
Still exists in MySQL 8.0.22 source build.