Bug #111714 Table constraint name ignored
Submitted: 11 Jul 2023 9:10 Modified: 11 Jul 2023 10:16
Reporter: Pedro Ferreira Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DDL Severity:S3 (Non-critical)
Version:8.0.33 OS:Ubuntu (22.04)
Assigned to: CPU Architecture:x86 (x86_64)
Tags: primary key

[11 Jul 2023 9:10] Pedro Ferreira
Description:
Run these statements:

mysql> CREATE TABLE t0 (c1 INT, CONSTRAINT k0 PRIMARY KEY (c1));
Query OK, 0 rows affected (0,10 sec)
mysql> ALTER TABLE t0 DROP CONSTRAINT k0;
ERROR 3940 (HY000): Constraint 'k0' does not exist.

I am confused about the error message. I named the primary key 'k0'. From reading the manual I see every primary key is named "PRIMARY". Shouldn't the create table generate an error, or a warning at least?

How to repeat:
Run the statements above.
[11 Jul 2023 10:16] MySQL Verification Team
Hello Pedro Ferreira,

Thank you for the report and test case.

regards,
Umesh