我创建了一个表:
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
求大神解释