Bug #111581 | "Multiple primary key defined" when sql_generate_invisible_primary_key=ON | ||
---|---|---|---|
Submitted: | 27 Jun 2023 11:07 | Modified: | 3 Jul 2023 9:13 |
Reporter: | Tinel Barb | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 8.0 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | Multiple primary key defined, replication fail, sql_generate_invisible_primary_key |
[27 Jun 2023 11:07]
Tinel Barb
[27 Jun 2023 14:07]
MySQL Verification Team
Hi Mr. Barb, Thank you for your bug report. However, what you are attempting is not supported. Luckily, our Manual contains the info on how to solve a problem. After you have created tmptable1, you change locally (just for that session) a value for sql_generate_invisible_primary_key to OFF, drop the column that is a primary key and add the primary key of your choice. Then you can revert that system variable to ON, if you wish. Your request for the change of behaviour with that system variable being at ON is not possible as it would break too many applications. Not a bug.
[30 Jun 2023 13:03]
MySQL Verification Team
Hi, This is indeed an expected behaviour. If you already have a primary key, then adding another one is a hard mistake. A table itself does not contain info on how was it created. You have a got a workaround that is very easy to implement, since "DROP PRIMARY KEY" is a very simple command. MySQL can not do "silent" dropping of any keys, since that would contradict the valid SQL standard.
[3 Jul 2023 12:20]
MySQL Verification Team
You are truly welcome.