0
Searching answer

Problem with MODIFY COLUMN

Thomas Hamper 8 years ago updated by Rafał Strzaliński (Senior Engineer) 8 years ago 2

[MySQL 5.7]


I found that the queries


CREATE TABLE `test` (
  `test_id` int(16) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;


ALTER TABLE `test`
  ADD PRIMARY KEY (`test_id`);


ALTER TABLE `test`
  MODIFY `test_id` int(16) AUTO_INCREMENT;


seem to be parsed in a strange way. After importing the above as a script and viewing the generated table as SQL it shows


CREATE TABLE test (
  test_id int(16) NULL AUTO_INCREMENT,
  test_id int(16) NULL AUTO_INCREMENT,
  CONSTRAINT test_pk PRIMARY KEY (test_id)
) ENGINE InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;


Which is not what I had in mind but I cannot figure out the problem. 

MySQL Workbench parses this in the wrong way, too - ignoring the MODIFY completely.

PHPMyAdmin on the other hand does it correctly.


Any thoughts on this? :-)


Thanks!





This is what command line MySQL says. Looking good :-)

Searching answer

Hi,


This is a bug. We're working on it.