Bug #40108 Partitioning by function UNIX_TIMESTAMP() is not supported
Submitted: 17 Oct 2008 14:18 Modified: 3 Dec 2008 15:16
Reporter: Veli-Matti Lahtela Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Partitions Severity:S4 (Feature request)
Version:5.1.28 OS:Any
Assigned to: CPU Architecture:Any
Tags: partitioning, unix_timestamp()

[17 Oct 2008 14:18] Veli-Matti Lahtela
Description:

Partitioning table based on unix_timestamp according to documentation this is not supported and it would be common way to use partitioning by time.

How to repeat:
mysql>
mysql> CREATE TABLE part_testing (
    ->    `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP() COMMENT 'Instert_Time',
    ->    `store_id` INT NOT NULL,
    ->    primary key ( timestamp )
    -> )ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='partitioning test ip tbl'
    -> PARTITION BY RANGE ( UNIX_TIMESTAMP(timestamp) ) (
    ->     PARTITION p2008101710 VALUES LESS THAN (1224226800),
    ->     PARTITION p2008101711 VALUES LESS THAN (1224230400),
    ->     PARTITION p2008101712 VALUES LESS THAN (1224234000)
    -> );
ERROR 1564 (HY000): This partition function is not allowed
mysql>

Suggested fix:

Support this function..
:]
[18 Oct 2008 4:38] Valeriy Kravchuk
Thank you for a reasonable feature request.
[3 Dec 2008 15:16] Mattias Jonsson
This is a duplicate of bug#28928.

Please look into WL#3352, which also adds the to_seconds() function instead, which supports pruning as well.