I have MySQL server, version 5.7.25.
When I create a table, specifying primary key name e.g.:
CREATE TABLE IF NOT EXISTS `test` (
`test`.`id` BIGINT NOT NULL AUTO_INCREMENT ,
`test`.`name` VARCHAR(100) NOT NULL ,
PRIMARY KEY `pk_test` (`id`)
);
So when I call:
SELECT constraint_name FROM information_schema.table_constraints WHERE table_name = 'test'
I expect the value to be pk_test
, however, the value is PRIMARY
.
Why MySQL sets provided primary key name to PRIMARY
?