mysql 5.1.43 开始,对timestamp 类型的分区有所改变

mysql 5.1.43 开始,对timestamp 类型的分区有所改变

The UNIX_TIMESTAMP() function is now supported in partitioning expressions using TIMESTAMPcolumns. For example, it now possible to create a partitioned table such as this one:

CREATE TABLE t (c TIMESTAMP) 
PARTITION BY RANGE ( UNIX_TIMESTAMP(c) ) (
    PARTITION p0 VALUES LESS THAN (631148400),
    PARTITION p1 VALUES LESS THAN (946681200),
    PARTITION p2 VALUES LESS THAN (MAXVALUE)
);

All other expressions involving TIMESTAMP values are now rejected with an error when attempting to create a new partitioned table or to alter an existing partitioned table.

When accessing an existing partitioned table having a timezone-dependent partitioning function (where the table was using a previous version of MySQL), a warning rather than an error is issued. In such cases, you should fix the table. One way of doing this is to alter the table's partitioning expression so that it uses UNIX_TIMESTAMP(). (Bug #42849)

在分区时不能再使用to_days 等函数,只能使用unix_timestamp()函数了

请使用浏览器的分享功能分享到微信等