MySQL Forums
Forum List  »  General

Re: Primary Key Bug with Multiples of Same Column
Posted by: John Glista
Date: May 06, 2021 12:47PM

The result of select version() is:


We do not get an error executing ALTER TABLE package_tracking DROP PRIMARY KEY if we first remove the auto-increment attribute of the id column. But yes, if that is present, we do get the error you described.

We completely dropped the id column and attempted to re-create it using the syntax you provided:

alter table package_tracking add column id int unsigned primary key auto_increment;

And now, we have even more "id" values inside the primary key, as shown by the DDL dump:

create table if not exists package_tracking
tracking_id varchar(50) not null,
status_description varchar(256) null,
customer_order_number varchar(50) null,
distribution_order_number varchar(50) null,
service_description varchar(256) null,
actual_delivery_timestamp timestamp null,
actual_pickup_date timestamp null,
actual_ship_date date null,
actual_tender_date date null,
delivery_attempts int(5) null,
delivery_city varchar(100) null,
delivery_state varchar(50) null,
delivery_zip varchar(50) null,
delivery_country varchar(50) null,
event_timestamp timestamp null,
id int unsigned auto_increment,
primary key (id, id, id, id, id, id, id, id, id, id, id, id, id, id)

Options: ReplyQuote

Written By
Re: Primary Key Bug with Multiples of Same Column
May 06, 2021 12:47PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.