PARTITION BY RANGE ,problem for NULL values
Structure of my table.
CREATE TABLE `link_click` (
`uid` char(255) NOT NULL,
`lid` char(255) NOT NULL,
`ip_address` char(15) NOT NULL,
`user_agent` char(255) DEFAULT NULL,
`open_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`referrer` char(255) DEFAULT NULL,
`environ` text,
`country` char(255) NOT NULL,
KEY `lid` (`lid`),
KEY `country` (`country`),
KEY `open_date` (`open_date`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
While tring to partition on open_date,
ALTER TABLE link_click
PARTITION BY RANGE (to_days(open_date))
(
PARTITION p0 VALUES LESS THAN (to_days('0000-00-00')),
PARTITION p1 VALUES LESS THAN (to_days('2009-03-31')),
PARTITION p2 VALUES LESS THAN (to_days('2009-04-30')),
PARTITION p3 VALUES LESS THAN (to_days('2009-05-31')),
PARTITION p4 VALUES LESS THAN (to_days('2009-06-30')),
PARTITION p5 VALUES LESS THAN (to_days('2009-07-31')),
PARTITION p6 VALUES LESS THAN (to_days('2009-08-31')),
PARTITION p7 VALUES LESS THAN (to_days('2009-09-30')),
PARTITION p8 VALUES LESS THAN (to_days('2009-10-31')),
PARTITION p9 VALUES LESS THAN (to_days('2009-11-30')),
PARTITION p10 VALUES LESS THAN (to_days('2009-12-31')),
PARTITION p11 VALUES LESS THAN (to_days('2010-01-31')),
PARTITION p12 VALUES LESS THAN (to_days('2010-02-28')),
PARTITION p13 VALUES LESS THAN (to_days('2010-03-31')),
PARTITION p14 VALUES LESS THAN (to_days('2010-04-30')),
PARTITION p15 VALUES LESS THAN (to_days('2010-05-31')),
PARTITION p16 VALUES LESS THAN (to_days('2010-06-30')),
PARTITION p17 VALUES LESS THAN (to_days('2010-07-31')),
PARTITION p18 VALUES LESS THAN (to_days('2010-08-31')),
PARTITION p19 VALUES LESS THAN (to_days('2010-09-30')),
PARTITION p20 VALUES LESS THAN (to_days('2010-10-31')),
PARTITION p21 VALUES LESS THAN (to_days('2010-11-31')),
PARTITION p22 VALUES LESS THAN (to_days('2010-12-31')),
PARTITION p23 VALUES LESS THAN (to_days('2011-01-31')),
PARTITION p24 VALUES LESS THAN (to_days('2011-02-28')),
PARTITION p25 VALUES LESS THAN (to_days('2011-03-31')),
PARTITION p26 VALUES LESS THAN (to_days('2011-04-30')),
PARTITION p27 VALUES LESS THAN (to_days('2011-05-31')),
PARTITION p28 VALUES LESS THAN (to_days('2011-06-30')),
PARTITION p29 VALUES LESS THAN (to_days('2011-07-31')),
PARTITION p30 VALUES LESS THAN (to_days('2011-08-31')),
PARTITION p31 VALUES LESS THAN (to_days('2011-09-30')),
PARTITION p32 VALUES LESS THAN (to_days('2011-10-31')),
PARTITION p33 VALUES LESS THAN (to_days('2011-11-31')),
PARTITION p34 VALUES LESS THAN (to_days('2011-12-31')),
PARTITION p35 VALUES LESS THAN MAXVALUE
);
is giving error
ERROR 1566 (HY000): Not allowed to use NULL value in VALUES LESS THAN