ERROR 1105 (HY000): A PRIMARY KEY must include all columns in the table's partitioning function

MySQL里面主键及唯一索引都需要包含分区键,否则均会报错

CREATE TABLE `sample` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`trade_no` varchar(32) NOT NULL COMMENT 'xxx',
`trade_type` varchar(32) DEFAULT NULL COMMENT 'xxx',
`sub_trade_type` varchar(32) DEFAULT NULL COMMENT 'xxx',
`request_no` varchar(64) NOT NULL COMMENT 'xxx',
`request_date` date not null DEFAULT '2000-01-01' COMMENT 'xxx',
`product_code` varchar(32) DEFAULT NULL COMMENT 'xxx',
`trade_channel` varchar(16) DEFAULT NULL COMMENT 'xxx',
`trade_status` varchar(32) NOT NULL COMMENT 'xxx',
`revoke_flag` varchar(8) DEFAULT NULL COMMENT 'xxx',
`cancel_flag` varchar(8) DEFAULT NULL COMMENT 'xxx',
`original_trade_no` varchar(32) DEFAULT NULL COMMENT 'xxx',
`trade_finished_date` date DEFAULT NULL COMMENT 'xxx',
`pay_finish_date` date DEFAULT NULL COMMENT 'xxx',
`ccy` varchar(3) NOT NULL COMMENT 'xxx',
`trade_amt` bigint(16) NOT NULL COMMENT 'xxx',
`discount_amt` bigint(16) DEFAULT NULL COMMENT 'xxx',
`discount_info` varchar(256) DEFAULT NULL COMMENT 'xxx',
`pay_amt` bigint(16) DEFAULT NULL COMMENT 'xxx',
`billing_contract_no` bigint(20) not null DEFAULT 0 COMMENT 'xxx',
`billing_login_name` varchar(32) DEFAULT NULL COMMENT 'xxx',
`transfer_contract_no` varchar(16) DEFAULT NULL COMMENT 'xxx',
`transfer_login_name` varchar(32) DEFAULT NULL COMMENT 'xxx',
`transfer_flag` varchar(16) DEFAULT NULL COMMENT 'xxx',
`merchant_no` varchar(32) DEFAULT NULL COMMENT 'xxx',
`merchant_trade_no` varchar(32) DEFAULT NULL COMMENT 'xxx',
`merchant_name` varchar(256) DEFAULT NULL COMMENT 'xxx',
`goods_info` varchar(32) DEFAULT NULL COMMENT 'xxx',
`memo` varchar(256) DEFAULT NULL COMMENT 'xxx',
`created_at` date NOT NULL COMMENT 'xxx',
`created_by` varchar(32) NOT NULL COMMENT 'xxx',
`updated_at` date NOT NULL COMMENT 'xxx',
`updated_by` varchar(32) NOT NULL COMMENT 'xxx',
PRIMARY KEY (id,request_date)
) ENGINE=InnoDB AUTO_INCREMENT=5731 DEFAULT CHARSET=utf8 COMMENT='xxx'
partition by range (year(request_date)*100+month(request_date)) (
partition p201604 values less than (201604),
partition p201605 values less than (201605),
partition p201606 values less than (201606),
partition p201607 values less than (201607),
partition p201608 values less than (201608),
partition p201609 values less than (201609),
partition p201610 values less than (201610),
partition p201611 values less than (201611),
partition p201612 values less than (201612),
partition p201701 values less than (201701),
partition p201702 values less than (201702),
partition p201703 values less than (201703),
partition p201704 values less than (201704),
partition p201705 values less than (201705),
partition p201706 values less than (201706),
partition p201707 values less than (201707),
partition p201708 values less than (201708),
partition p201709 values less than (201709),
partition p201710 values less than (201710),
partition p201711 values less than (201711),
partition p201712 values less than (201712),
partition p201801 values less than (201801),
partition p201802 values less than (201802),
partition p201803 values less than (201803),
partition p201804 values less than (201804),
partition p201805 values less than (201805),
partition p201806 values less than (201806),
partition p201807 values less than (201807),
partition p201808 values less than (201808),
partition p201809 values less than (201809),
partition p201810 values less than (201810),
partition p201811 values less than (201811),
partition p201812 values less than (201812));

分区表主键不包含分区键报错ERROR 1105 (HY000)的更多相关文章

  1. mysql5.7设置简单密码报错ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

    注:本文来源于<  mysql5.7设置简单密码报错ERROR 1819 (HY000): Your password does not satisfy the current policy r ...

  2. mysql-创建用户报错ERROR 1396 (HY000): Operation CREATE USER failed for 'XXXX'@'XXXX'

    创建用户: create user 'test'@'%' identified by 'test'; 显示ERROR 1396 (HY000): Operation CREATE USER faile ...

  3. MySQL报错ERROR 1558 (HY000): Column count of mysql.user is wrong.

    MySQL报错ERROR 1558 (HY000): Column count of mysql.user is wrong. 1.今天在使用MySQL创建数据库时出现如下报错: mysql> ...

  4. 解决MySQL报错ERROR 2002 (HY000)【转】

    今天在为新的业务线搭架数据库后,在启动的时候报错 root@qsbilldatahis-db01:/usr/local/mysql/bin# ./mysql ERROR 2002 (HY000): C ...

  5. 第一次登录mysql,使用任何命令都报错ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

    问题: 使用临时密码登录成功后,使用任何myql命令,例如show databases;都提示下面的报错 ERROR 1820 (HY000): You must reset your passwor ...

  6. mysql-创建用户报错ERROR 1396 (HY000): Operation CREATE USER failed for 'XXXX'@'XXXX'(转载)

    创建用户: create user ‘test’@’%’ identified by ‘test’; 显示ERROR 1396 (HY000): Operation CREATE USER faile ...

  7. MySQL5.7 报错 ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement

    MySQL5.7 报错 : ERROR 1820 (HY000): You must reset your password using ALTER USER statement before exe ...

  8. mysql-创建用户报错ERROR 1396 (HY000): Operation CREATE USER failed for 'root'@'localhost'

    创建用户: create user ‘test’@’%’ identified by ‘test’; 显示ERROR 1396 (HY000): Operation CREATE USER faile ...

  9. MySQL报错ERROR 1436 (HY000): Thread stack overrun:

    今天搭私服的时候,卡在角色创建画面,日志报错如上. 这是MySQL报错ERROR 1436 (HY000): Thread stack overrun:   修改方法 vim /etc/my.cnf ...

随机推荐

  1. threejs- z-fighting 问题(模型的重叠部位便不停的闪烁起来。这便是Z-Fighting问题)

    Z-Buffer 在threejs中,使用深度缓冲(Z-Buffer)来完成场景可见性计算,即确定场景哪部分可见,哪部分不可见.深度缓冲(Z-Buffer)是一个二维数组,其中的每一个元素对应屏幕上的 ...

  2. svn冲突问题解决办法

    经常有人会说,树冲突是很难解决的一类冲突,其实一旦了解了其原理,要解决也不难.先回顾下对于树冲突的定义.     树冲突:当一名开发人员移动.重命名.删除一个文件或文件夹,而另一名开发人员也对它们进行 ...

  3. 20172306《Java程序设计》第四周学习总结

    20172306 <Java程序设计>第四周学习总结 教材学习内容总结 第四章: 1. 类和对象的回顾:除了看书,我还上网找了一下两者的一些区别. 2. 编写类时,了解到初始化.形式参数. ...

  4. Codeforces 749C. Voting 模拟题

    C. Voting time limit per test: 1 second memory limit per test: 256 megabytes input: standard input o ...

  5. 清晰易懂!关于PS入门的超详细笔记!

    给大家分享一篇关于PS入门的超详细笔记!原理讲解清晰明了,虽不是新版本解析,但都是新手学习PS必掌懂的一些知识点,灰常的实用,转走收藏学习! 编辑:千锋UI设计 来源:PS学堂

  6. About the Cron Expression

    About the Cron Expression Cron is use in Linux for the time schedule Format Seconds Minutes Hours Da ...

  7. Linux安装及入门

    Linux安装及学习 Linux遇到的问题: 在安装过程中因为代码输错(少空格)而质疑自己下载的ubuntu和virtualbox版本,于是卸载之后重新安装了一次,后来才发现是代码输错了(教程中的空格 ...

  8. Spring ApplicationContext(一)初始化过程

    Spring 容器 ApplicationContext(一)初始化过程 Spring 系列目录(https://www.cnblogs.com/binarylei/p/10198698.html) ...

  9. Python之路(第二十四篇) 面向对象初级:多态、封装

    一.多态 多态 多态:一类事物有多种形态,同一种事物的多种形态,动物分为鸡类,猪类.狗类 例子 import abc class H2o(metaclass=abc.ABCMeta): ​ def _ ...

  10. PHP redis 群发短信

    $redis = new \Redis(); $redis->connect('127.0.0.1', 6379); $list = M('Sms')->field('phone')-&g ...