CREATE TABLE `cloud_ip_cost_details1` (
`ipcost_details_id` INT(11) NOT NULL AUTO_INCREMENT,
`server_entry_id` INT(11) DEFAULT NULL,
`ip_address` BLOB,
`project_name` VARCHAR(500) DEFAULT NULL,
`project_id` INT(11) DEFAULT NULL,
`group_id` INT(11) DEFAULT NULL,
`division_id` INT(11) DEFAULT NULL,
`cost` BLOB,
`period` VARCHAR(50) DEFAULT NULL,
`updated_by` VARCHAR(20) DEFAULT NULL,
`temp_id` BIGINT(20) DEFAULT NULL,
PRIMARY KEY (`ipcost_details_id`)
)
PARTITION BY LIST(period)(
PARTITION Jan2017 VALUES IN ('Jan-2017')
);
错误代码:1697
分区'Jan2017'的VALUES值必须具有INT
类型
答案 0 :(得分:0)
我们需要做出一些改变:
PARTITION BY LIST COLUMNS
短语而不是PARTITION BY COLUMNS
period
添加到primary key
。下面应该有效:
CREATE TABLE `cloud_ip_cost_details1` (
`ipcost_details_id` INT(11) NOT NULL AUTO_INCREMENT,
`server_entry_id` INT(11) DEFAULT NULL,
`ip_address` BLOB,
`project_name` VARCHAR(500) DEFAULT NULL,
`project_id` INT(11) DEFAULT NULL,
`group_id` INT(11) DEFAULT NULL,
`division_id` INT(11) DEFAULT NULL,
`cost` BLOB,
`period` VARCHAR(50) DEFAULT NULL,
`updated_by` VARCHAR(20) DEFAULT NULL,
`temp_id` BIGINT(20) DEFAULT NULL,
PRIMARY KEY (`ipcost_details_id`, `period`)
)
PARTITION BY LIST COLUMNS(period)(
PARTITION Jan2017 VALUES IN ('Jan-2017')
);
这里是 here 。
答案 1 :(得分:0)
尝试这样:
PARTITION BY LIST COLUMNS(period) (
PARTITION Jan2017 VALUES IN('Jan-2017')
);
或者这个:
PARTITION BY RANGE (period)
( PARTITION Jan2017 VALUES LESS THAN (TO_DAYS('2012-07-01'))
);
文档:https://dev.mysql.com/doc/refman/5.5/en/partitioning-columns-list.html