-
-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
TiDB adopts a clustered index by default, which means it does not allow the table to exist without a PRIMARY KEY.
Because of this, any ALTER statement generated by conv that renames the primary key will result in an error at runtime. While one way to address this in TiDB is to recreate the table and migrate the data, the current conv tool only performs schema changes without manipulating actual data. Therefore, we need to determine the best approach for handling this issue.
CREATE TABLE `tbl_music` (
`music_id` int NOT NULL COMMENT 'Unique music ID',
`music_id2` int NOT NULL COMMENT 'Unique music ID2',
PRIMARY KEY (`music_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='Music';
ALTER TABLE `tbl_music`
DROP PRIMARY KEY,
ADD PRIMARY KEY (`music_id2`);
// [HY000][8200] Unsupported drop primary key when the table is using clustered index
Metadata
Metadata
Assignees
Labels
No labels