|
mysql5.1.56版本,加varchar字段分区,报错:ERROR 1503 (HY000): A PRIMARY KEY must include all columns in the table's partitioning function
mysql> DROP TABLE tkc;
ERROR 1051 (42S02): Unknown table 'tkc'
mysql> CREATE TABLE `tkc` (
-> `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '自增长序列',
-> `cr` CHAR(1) DEFAULT NULL,
-> PRIMARY KEY (`id`)
-> ) ENGINE=INNODB CONNECTION=' table "tkc", user "msandbox", password "msandbox" '
-> PARTITION BY KEY (id,cr)
-> PARTITIONS 20;
ERROR 1503 (HY000): A PRIMARY KEY must include all columns in the table's partitioning function
mysql>
mysql>
mysql> DROP TABLE tkc;
ERROR 1051 (42S02): Unknown table 'tkc'
mysql> CREATE TABLE `tkc` (
-> `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '自增长序列',
-> `cr` CHAR(1) DEFAULT NULL,
-> PRIMARY KEY (`id`,cr) -- 主键中必须包含分区字段。
-> ) ENGINE=INNODB CONNECTION=' table "tkc", user "msandbox", password "msandbox" '
-> PARTITION BY KEY (cr)
-> PARTITIONS 20;
Query OK, 0 rows affected (1.16 sec)
mysql>
|
|