mysql 分区后,修改主键,自增失效 5C

我创建了一个表:
create table part(id int) partition by range(id)(partition p0 values less than (1), partition p1 values less than (2), partition p2 values less than (3), partition p3 values less than (4), partition pm values less than maxvalue);
然后插入数据:
insert into part values(0),(1),(2),(3),(4);
然后我想修改id字段的名字和约束:
alter table part change id code int not null;
这时收到一个错误:
(1054, u"Unknown column 'id' in 'partition function'")
所以我做了如下操作:
alter table part change id code int not null, add id int primary key auto_increment;
执行貌似成功,但是收到一个错误,结果如下:
Query OK, 0 rows affected
Time: 16.519s
(1065, u'Query was empty')
然后select查看part表:
select * from part;
结果却是这样:
+------+----+
| code | id |
+------+----+
| 0 | 1 |
| 1 | 1 |
| 2 | 1 |
| 3 | 1 |
| 4 | 1 |
+------+----+
5 rows in set
Time: 0.015s
求大神解释

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐