PARTITION p0 VALUESLESS THAN (TO_DAYS('2010-04-15')),
PARTITION p1 VALUESLESS THAN (TO_DAYS('2010-05-01')),
PARTITION p2 VALUESLESS THAN (TO_DAYS('2010-05-15')),
PARTITION p3 VALUESLESS THAN (TO_DAYS('2010-05-31')),
PARTITION p4 VALUESLESS THAN (TO_DAYS('2010-06-15')),
PARTITION p19 VALUESLESS ThAN MAXVALUE);
错误提示:#1503
1
A PRIMARYKEYMUST INCLUDE ALLCOLUMNS INTHE TABLE'S PARTITIONING FUNCTION
MySQL主键的限制,每一个分区表中的公式中的列,必须在主键“unique key”中包括
在MYSQL的官方文档里是这么说明的
18.5.1. Partitioning Keys, Primary Keys, and Unique Keys
This section discusses the relationship of partitioning keys with primary keys and unique keys. The rule governing this relationship can be expressed as follows: All columns used in the partitioning expression for a partitioned table must be part of every unique key that the table may have.
In other words,every unique key on the table must use every columnin the table's partitioning expression. (This also includes the table's primary key, since it is by definition a unique key. This particular case is discussed later in this section.) For example, each of the following table creation statements is invalid: