逻辑库结构和物理库表结构如下(逻辑库结构=物理库表结构):
CREATE TABLE `order_key` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`goods_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '商品名称',
`place` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '下单地点',
`make_date` date NULL DEFAULT NULL COMMENT '下单日期',
`make_time` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '下单时间',
`modify_date` date NULL DEFAULT NULL COMMENT '修改日期',
`modify_time` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '修改时间',
`gender` int(1) NULL DEFAULT NULL COMMENT '性别',
`status` int(1) NULL DEFAULT NULL COMMENT '上下架 0-上架 1-下架',
`user_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户名称',
`user_phone` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户电话',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 35 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '订单表' ROW_FORMAT = Dynamic;
在mycat中插入数据如下:
INSERT INTO `order_key` VALUES (1, '苹果1', '上海1', '2019-08-25', '15:44:32', '2019-08-25', '15:44:32', 1, 0, '雨昕1', '1');
INSERT INTO `order_key` VALUES (2, '苹果2', '上海2', '2019-08-25', '15:44:32', '2019-08-25', '15:44:32', 1, 0, '雨昕2', '2');
INSERT INTO `order_key` VALUES (3, '苹果3', '上海3', '2019-08-25', '15:44:32', '2019-08-25', '15:44:32', 1, 0, '雨昕3', '3');
INSERT INTO `order_key` VALUES (4, '苹果4', '上海4', '2019-08-25', '15:44:32', '2019-08-25', '15:44:32', 1, 0, '雨昕4', '4');
INSERT INTO `order_key` VALUES (5, '苹果5', '上海5', '2019-08-25', '15:44:32', '2019-08-25', '15:44:32', 1, 0, '雨昕5', '5');
INSERT INTO `order_key` VALUES (6, '苹果6', '上海6', '2019-08-25', '15:44:32', '2019-08-25', '15:44:32', 1, 0, '雨昕6', '6');
INSERT INTO `order_key` VALUES (7, '苹果7', '上海7', '2019-08-25', '15:44:32', '2019-08-25', '15:44:32', 1, 0, '雨昕7', '7');
INSERT INTO `order_key` VALUES (8, '苹果8', '上海8', '2019-08-25', '15:44:32', '2019-08-25', '15:44:32', 1, 0, '雨昕8', '8');
INSERT INTO `order_key` VALUES (9, '苹果9', '上海9', '2019-08-25', '15:44:32', '2019-08-25', '15:44:32', 1, 0, '雨昕9', '9');
INSERT INTO `order_key` VALUES (10, '苹果10', '上海10', '2019-08-25', '15:44:32', '2019-07-21', '15:44:32', 1, 0, '雨昕10', '10');
异常信息如下:
INSERT INTO `order_key` VALUES (10, '苹果10', '上海10', '2019-082-5', '15:44:32', '2019-07-21', '15:44:32', 1, 0, '雨昕10', '10');
ERROR 1064 (HY000): partition table, insert must provide ColumnList
解决方案:
插入数据是要指定列名
正确插入sql语句如下:
INSERT INTO `order_key` (`id`,goods_name,place,make_date,make_time,modify_date,modify_time,gender,status,user_name,user_phone) VALUES (1, '苹果1', '上海1', '2019-08-25', '15:44:32', '2019-08-25', '15:44:32', 1, 0, '雨昕1', '1');
INSERT INTO `order_key` (`id`,goods_name,place,make_date,make_time,modify_date,modify_time,gender,status,user_name,user_phone) VALUES (2, '苹果2', '上海2', '2019-08-25', '15:44:32', '2019-08-25', '15:44:32', 1, 0, '雨昕2', '2');
INSERT INTO `order_key` (`id`,goods_name,place,make_date,make_time,modify_date,modify_time,gender,status,user_name,user_phone) VALUES (3, '苹果3', '上海3', '2019-08-25', '15:44:32', '2019-08-25', '15:44:32', 1, 0, '雨昕3', '3');
INSERT INTO `order_key` (`id`,goods_name,place,make_date,make_time,modify_date,modify_time,gender,status,user_name,user_phone) VALUES (4, '苹果4', '上海4', '2019-08-25', '15:44:32', '2019-08-25', '15:44:32', 1, 0, '雨昕4', '4');
INSERT INTO `order_key` (`id`,goods_name,place,make_date,make_time,modify_date,modify_time,gender,status,user_name,user_phone) VALUES (5, '苹果5', '上海5', '2019-08-25', '15:44:32', '2019-08-25', '15:44:32', 1, 0, '雨昕5', '5');
INSERT INTO `order_key` (`id`,goods_name,place,make_date,make_time,modify_date,modify_time,gender,status,user_name,user_phone) VALUES (6, '苹果6', '上海6', '2019-08-25', '15:44:32', '2019-08-25', '15:44:32', 1, 0, '雨昕6', '6');
INSERT INTO `order_key` (`id`,goods_name,place,make_date,make_time,modify_date,modify_time,gender,status,user_name,user_phone) VALUES (7, '苹果7', '上海7', '2019-08-25', '15:44:32', '2019-08-25', '15:44:32', 1, 0, '雨昕7', '7');
INSERT INTO `order_key` (`id`,goods_name,place,make_date,make_time,modify_date,modify_time,gender,status,user_name,user_phone) VALUES (8, '苹果8', '上海8', '2019-08-25', '15:44:32', '2019-08-25', '15:44:32', 1, 0, '雨昕8', '8');
INSERT INTO `order_key` (`id`,goods_name,place,make_date,make_time,modify_date,modify_time,gender,status,user_name,user_phone) VALUES (9, '苹果9', '上海9', '2019-08-25', '15:44:32', '2019-08-25', '15:44:32', 1, 0, '雨昕9', '9');
INSERT INTO `order_key` (`id`,goods_name,place,make_date,make_time,modify_date,modify_time,gender,status,user_name,user_phone) VALUES (10, '苹果10', '上海10', '2019-08-25', '15:44:32', '2019-07-21', '15:44:32', 1, 0, '雨昕10', '10');
截图附上: