Adding Primary Key Error - 8200 - Unsupported Multi Schema Change

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 新增主键报错-8200 - Unsupported multi schema change

| username: 普罗米修斯

[TiDB Usage Environment] Production Environment
[TiDB Version] V5.2.4
[Reproduction Path] Adding a primary key to the table reports error 8200 - Unsupported multi schema change

UPDATE Reference_AAD SET Entity = REPLACE(Entity, EntityName, “”) ORDER BY CreateTime DESC;
UPDATE Reference_AAD SET Entity = REPLACE(Entity, “&&”, “”) ORDER BY CreateTime DESC;

| username: tidb狂热爱好者 | Original post link

Only one column of data can be changed at a time.

| username: hey-hoho | Original post link

Version 5 does not yet support multiple schema changes at once. You can check the change SQL generated by Navicat through SQL preview. Starting from approximately version 6.2, multiple schema changes will be supported.

| username: 普罗米修斯 | Original post link

I just updated a column. The primary key 123 already existed before, and adding the primary key 4 resulted in an error.

| username: 啦啦啦啦啦 | Original post link

Try using the alter command.

| username: 普罗米修斯 | Original post link

Is this it? I see that the SQL execution itself is an alter.

| username: 啦啦啦啦啦 | Original post link

Drop it first, then add it, split into two statements.

| username: 普罗米修斯 | Original post link

Thank you. Performing the operations separately worked. Resetting the primary key on a large table is indeed very slow.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.