Description:
I create a table as follows:
CREATE TABLE jed_part (
loop_name varchar(45) DEFAULT NULL,
loop_id integer NOT NULL,
ts timestamp NULL DEFAULT CURRENT_TIMESTAMP,
obj_id integer NOT NULL,
loc_id integer DEFAULT NULL,
param_name varchar(100) NOT NULL,
param_value varchar(100) DEFAULT NULL,
KEY jed_part_ndx1 (loop_id,obj_id),
KEY jed_part_ndx2 (loop_id,ts),
KEY jed_part_ndx3 (ts)
) ENGINE=InnoDB
PARTITION BY RANGE ( UNIX_TIMESTAMP(ts) ) (
PARTITION p20111225 VALUES LESS THAN ( UNIX_TIMESTAMP('2011-12-25 00:00:00') ),
PARTITION p20111226 VALUES LESS THAN ( UNIX_TIMESTAMP('2011-12-26 00:00:00') )
);
I then tried to add a partition:
alter table jed_part add partition (partition p20111227 values then than (unix_timestamp('2011-12-27 00:00:00'));
and got:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'then than (unix_timestamp('2011-12-28 00:00:00'))' at line 1
but finally figured out you can do:
alter table jed_part add partition (partition p20111227 values less than (1324969200));
I've looked at the syntax and unless I'm just missing it, it would appear that you can use unix_timestamp in the "create table" but not in the "alter table"
How to repeat:
See above (unless I'm doing something stupid, I am new to MySQL - Oracle since 1997)
Suggested fix:
enable same syntax in alter table add partition