This morning I received an update on a MySQL bug, someone added a comment on an issue I filed in November 2003, originally for MySQL 4.0.12 and 4.1.0. It’s MySQL bug#1956 (note the very low number!), “Parser allows naming of PRIMARY KEY”:
[25 Nov 2003 16:23] Arjen Lentz Description: When specifying a PRIMARY KEY, the parser still accepts a name for the index even though the MySQL server will always name it PRIMARY. So, the parser should NOT accept this, otherwise a user can get into a confusing situation as his input is ignored/changed. How to repeat: CREATE TABLE pk (i INT NOT NULL); ALTER TABLE pk ADD PRIMARY KEY bla (i); 'bla' after PRIMARY KEY should not be accepted. Suggested fix: Fix grammar in parser.
Most likely we found it during a MySQL training session, training days have always been a great bug catching …
[Read more]