mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug #42849: innodb crash with varying time_zone on partitioned
timestamp primary key Since TIMESTAMP values are adjusted by the current time zone settings in both numeric and string contexts, using any expressions involving TIMESTAMP values as a (sub)partitioning function leads to undeterministic behavior of partitioned tables. The effect may vary depending on a storage engine, it can be either incorrect data being retrieved or stored, or an assertion failure. The root cause of this is the fact that the calculated partition ID may differ from a previously calculated ID for the same data due to timezone adjustments of the partitioning expression value. Fixed by disabling any expressions involving TIMESTAMP values to be used in partitioning functions with the follwing two exceptions: 1. Creating or altering into a partitioned table that violates the above rule is not allowed, but opening existing such tables results in a warning rather than an error so that such tables could be fixed. 2. UNIX_TIMESTAMP() is the only way to get a timezone-independent value from a TIMESTAMP column, because it returns the internal representation (a time_t value) of a TIMESTAMP argument verbatim. So UNIX_TIMESTAMP(timestamp_column) is allowed and should be used to fix existing tables if one wants to use TIMESTAMP columns with partitioning. mysql-test/r/partition_bug18198.result: Corrected the error. mysql-test/r/partition_error.result: Corrected error texts. Added test cases for bug #42849. mysql-test/t/partition_bug18198.test: Corrected error code. mysql-test/t/partition_error.test: Corrected error codes. Added test cases for bug #42849. sql/item.h: Added is_timezone_dependent_processor() to Item. sql/item_func.h: Added has_timestamp_args() and the implementation of is_timezone_dependent_processor() for Item_func. sql/item_timefunc.h: Added is_timezone_dependent_processor() to Item_func_unix_timestamp. sql/share/errmsg.txt: Renamed ER_CONST_EXPR_IN_PARTITION_FUNC_ERROR to ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR to better reflect the meaning. Adjusted the error message. sql/sql_partition.cc: Modified fix_fields_part_func() to walk through partitioning expression tree with is_timezone_dependent_processor() and issue a warning/error if it depends on the timezone settings. Changed fix_fields_part_func() to a static function since it is not used anywhere except sql_partition.cc sql/sql_partition.h: Removed the unneeded declaration of fix_fields_part_func() since it is now a static function. sql/sql_yacc.yy: ER_CONST_EXPR_IN_PARTITION_FUNC_ERROR -> ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR.
This commit is contained in:
@ -138,7 +138,7 @@ primary key(a,b))
|
||||
partition by hash (rand(a))
|
||||
partitions 2
|
||||
(partition x1, partition x2);
|
||||
ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')
|
||||
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')
|
||||
partitions 2
|
||||
(partition x1, partition x2)' at line 6
|
||||
CREATE TABLE t1 (
|
||||
@ -149,7 +149,7 @@ primary key(a,b))
|
||||
partition by range (rand(a))
|
||||
partitions 2
|
||||
(partition x1 values less than (0), partition x2 values less than (2));
|
||||
ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')
|
||||
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')
|
||||
partitions 2
|
||||
(partition x1 values less than (0), partition x2 values less than' at line 6
|
||||
CREATE TABLE t1 (
|
||||
@ -160,7 +160,7 @@ primary key(a,b))
|
||||
partition by list (rand(a))
|
||||
partitions 2
|
||||
(partition x1 values in (1), partition x2 values in (2));
|
||||
ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')
|
||||
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')
|
||||
partitions 2
|
||||
(partition x1 values in (1), partition x2 values in (2))' at line 6
|
||||
CREATE TABLE t1 (
|
||||
@ -275,7 +275,7 @@ c int not null,
|
||||
primary key (a,b))
|
||||
partition by key (a)
|
||||
subpartition by hash (rand(a+b));
|
||||
ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')' at line 7
|
||||
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')' at line 7
|
||||
CREATE TABLE t1 (
|
||||
a int not null,
|
||||
b int not null,
|
||||
@ -372,7 +372,7 @@ partition by range (3+4)
|
||||
partitions 2
|
||||
(partition x1 values less than (4) tablespace ts1,
|
||||
partition x2 values less than (8) tablespace ts2);
|
||||
ERROR HY000: Constant/Random expression in (sub)partitioning function is not allowed
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (
|
||||
a int not null,
|
||||
b int not null,
|
||||
@ -542,7 +542,7 @@ partition by list (3+4)
|
||||
partitions 2
|
||||
(partition x1 values in (4) tablespace ts1,
|
||||
partition x2 values in (8) tablespace ts2);
|
||||
ERROR HY000: Constant/Random expression in (sub)partitioning function is not allowed
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (
|
||||
a int not null,
|
||||
b int not null,
|
||||
@ -634,13 +634,13 @@ partition by range (ascii(v))
|
||||
ERROR HY000: This partition function is not allowed
|
||||
create table t1 (a int)
|
||||
partition by hash (rand(a));
|
||||
ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')' at line 2
|
||||
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')' at line 2
|
||||
create table t1 (a int)
|
||||
partition by hash(CURTIME() + a);
|
||||
ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')' at line 2
|
||||
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')' at line 2
|
||||
create table t1 (a int)
|
||||
partition by hash (NOW()+a);
|
||||
ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')' at line 2
|
||||
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')' at line 2
|
||||
create table t1 (a int)
|
||||
partition by hash (extract(hour from convert_tz(a, '+00:00', '+00:00')));
|
||||
ERROR HY000: This partition function is not allowed
|
||||
@ -651,3 +651,295 @@ ERROR HY000: This partition function is not allowed
|
||||
create table t1 (a char(10))
|
||||
partition by hash (extractvalue(a,'a'));
|
||||
ERROR HY000: This partition function is not allowed
|
||||
#
|
||||
# Bug #42849: innodb crash with varying time_zone on partitioned
|
||||
# timestamp primary key
|
||||
#
|
||||
CREATE TABLE old (a TIMESTAMP NOT NULL PRIMARY KEY)
|
||||
PARTITION BY RANGE (UNIX_TIMESTAMP(a)) (
|
||||
PARTITION p VALUES LESS THAN (1219089600),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
|
||||
PARTITION BY RANGE (a) (
|
||||
PARTITION p VALUES LESS THAN (20080819),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: The PARTITION function returns the wrong type
|
||||
ALTER TABLE old
|
||||
PARTITION BY RANGE (a) (
|
||||
PARTITION p VALUES LESS THAN (20080819),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: The PARTITION function returns the wrong type
|
||||
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
|
||||
PARTITION BY RANGE (a+0) (
|
||||
PARTITION p VALUES LESS THAN (20080819),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
ALTER TABLE old
|
||||
PARTITION BY RANGE (a+0) (
|
||||
PARTITION p VALUES LESS THAN (20080819),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
|
||||
PARTITION BY RANGE (a % 2) (
|
||||
PARTITION p VALUES LESS THAN (20080819),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
ALTER TABLE old
|
||||
PARTITION BY RANGE (a % 2) (
|
||||
PARTITION p VALUES LESS THAN (20080819),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
|
||||
PARTITION BY RANGE (ABS(a)) (
|
||||
PARTITION p VALUES LESS THAN (20080819),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
ALTER TABLE old
|
||||
PARTITION BY RANGE (ABS(a)) (
|
||||
PARTITION p VALUES LESS THAN (20080819),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
|
||||
PARTITION BY RANGE (CEILING(a)) (
|
||||
PARTITION p VALUES LESS THAN (20080819),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
ALTER TABLE old
|
||||
PARTITION BY RANGE (CEILING(a)) (
|
||||
PARTITION p VALUES LESS THAN (20080819),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
|
||||
PARTITION BY RANGE (FLOOR(a)) (
|
||||
PARTITION p VALUES LESS THAN (20080819),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
ALTER TABLE old
|
||||
PARTITION BY RANGE (FLOOR(a)) (
|
||||
PARTITION p VALUES LESS THAN (20080819),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
|
||||
PARTITION BY RANGE (TO_DAYS(a)) (
|
||||
PARTITION p VALUES LESS THAN (733638),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
ALTER TABLE old
|
||||
PARTITION BY RANGE (TO_DAYS(a)) (
|
||||
PARTITION p VALUES LESS THAN (733638),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
|
||||
PARTITION BY RANGE (DAYOFYEAR(a)) (
|
||||
PARTITION p VALUES LESS THAN (231),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
ALTER TABLE old
|
||||
PARTITION BY RANGE (DAYOFYEAR(a)) (
|
||||
PARTITION p VALUES LESS THAN (231),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
|
||||
PARTITION BY RANGE (DAYOFMONTH(a)) (
|
||||
PARTITION p VALUES LESS THAN (19),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
ALTER TABLE old
|
||||
PARTITION BY RANGE (DAYOFMONTH(a)) (
|
||||
PARTITION p VALUES LESS THAN (19),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
|
||||
PARTITION BY RANGE (DAYOFWEEK(a)) (
|
||||
PARTITION p VALUES LESS THAN (3),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
ALTER TABLE old
|
||||
PARTITION BY RANGE (DAYOFWEEK(a)) (
|
||||
PARTITION p VALUES LESS THAN (3),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
|
||||
PARTITION BY RANGE (MONTH(a)) (
|
||||
PARTITION p VALUES LESS THAN (8),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
ALTER TABLE old
|
||||
PARTITION BY RANGE (MONTH(a)) (
|
||||
PARTITION p VALUES LESS THAN (8),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
|
||||
PARTITION BY RANGE (HOUR(a)) (
|
||||
PARTITION p VALUES LESS THAN (17),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
ALTER TABLE old
|
||||
PARTITION BY RANGE (HOUR(a)) (
|
||||
PARTITION p VALUES LESS THAN (17),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
|
||||
PARTITION BY RANGE (MINUTE(a)) (
|
||||
PARTITION p VALUES LESS THAN (55),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
ALTER TABLE old
|
||||
PARTITION BY RANGE (MINUTE(a)) (
|
||||
PARTITION p VALUES LESS THAN (55),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
|
||||
PARTITION BY RANGE (QUARTER(a)) (
|
||||
PARTITION p VALUES LESS THAN (3),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
ALTER TABLE old
|
||||
PARTITION BY RANGE (QUARTER(a)) (
|
||||
PARTITION p VALUES LESS THAN (3),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
|
||||
PARTITION BY RANGE (SECOND(a)) (
|
||||
PARTITION p VALUES LESS THAN (7),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
ALTER TABLE old
|
||||
PARTITION BY RANGE (SECOND(a)) (
|
||||
PARTITION p VALUES LESS THAN (7),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
|
||||
PARTITION BY RANGE (YEARWEEK(a)) (
|
||||
PARTITION p VALUES LESS THAN (200833),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
ALTER TABLE old
|
||||
PARTITION BY RANGE (YEARWEEK(a)) (
|
||||
PARTITION p VALUES LESS THAN (200833),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
|
||||
PARTITION BY RANGE (YEAR(a)) (
|
||||
PARTITION p VALUES LESS THAN (2008),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
ALTER TABLE old
|
||||
PARTITION BY RANGE (YEAR(a)) (
|
||||
PARTITION p VALUES LESS THAN (2008),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
|
||||
PARTITION BY RANGE (WEEKDAY(a)) (
|
||||
PARTITION p VALUES LESS THAN (3),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
ALTER TABLE old
|
||||
PARTITION BY RANGE (WEEKDAY(a)) (
|
||||
PARTITION p VALUES LESS THAN (3),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
|
||||
PARTITION BY RANGE (TIME_TO_SEC(a)) (
|
||||
PARTITION p VALUES LESS THAN (64507),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
ALTER TABLE old
|
||||
PARTITION BY RANGE (TIME_TO_SEC(a)) (
|
||||
PARTITION p VALUES LESS THAN (64507),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
|
||||
PARTITION BY RANGE (EXTRACT(DAY FROM a)) (
|
||||
PARTITION p VALUES LESS THAN (18),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
ALTER TABLE old
|
||||
PARTITION BY RANGE (EXTRACT(DAY FROM a)) (
|
||||
PARTITION p VALUES LESS THAN (18),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE new (a TIMESTAMP NOT NULL, b TIMESTAMP NOT NULL, PRIMARY KEY(a,b))
|
||||
PARTITION BY RANGE (DATEDIFF(a, a)) (
|
||||
PARTITION p VALUES LESS THAN (18),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
ALTER TABLE old
|
||||
PARTITION BY RANGE (DATEDIFF(a, a)) (
|
||||
PARTITION p VALUES LESS THAN (18),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
|
||||
PARTITION BY RANGE (YEAR(a + 0)) (
|
||||
PARTITION p VALUES LESS THAN (2008),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
ALTER TABLE old
|
||||
PARTITION BY RANGE (YEAR(a + 0)) (
|
||||
PARTITION p VALUES LESS THAN (2008),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
|
||||
PARTITION BY RANGE (TO_DAYS(a + '2008-01-01')) (
|
||||
PARTITION p VALUES LESS THAN (733638),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
ALTER TABLE old
|
||||
PARTITION BY RANGE (TO_DAYS(a + '2008-01-01')) (
|
||||
PARTITION p VALUES LESS THAN (733638),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
|
||||
PARTITION BY RANGE (YEAR(a + '2008-01-01')) (
|
||||
PARTITION p VALUES LESS THAN (2008),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
ALTER TABLE old
|
||||
PARTITION BY RANGE (YEAR(a + '2008-01-01')) (
|
||||
PARTITION p VALUES LESS THAN (2008),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
ALTER TABLE old ADD COLUMN b DATE;
|
||||
CREATE TABLE new (a TIMESTAMP, b DATE)
|
||||
PARTITION BY RANGE (YEAR(a + b)) (
|
||||
PARTITION p VALUES LESS THAN (2008),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
ALTER TABLE old
|
||||
PARTITION BY RANGE (YEAR(a + b)) (
|
||||
PARTITION p VALUES LESS THAN (2008),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE new (a TIMESTAMP, b DATE)
|
||||
PARTITION BY RANGE (TO_DAYS(a + b)) (
|
||||
PARTITION p VALUES LESS THAN (733638),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
ALTER TABLE old
|
||||
PARTITION BY RANGE (TO_DAYS(a + b)) (
|
||||
PARTITION p VALUES LESS THAN (733638),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE new (a TIMESTAMP, b date)
|
||||
PARTITION BY RANGE (UNIX_TIMESTAMP(a + b)) (
|
||||
PARTITION p VALUES LESS THAN (1219089600),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
ALTER TABLE old
|
||||
PARTITION BY RANGE (UNIX_TIMESTAMP(a + b)) (
|
||||
PARTITION p VALUES LESS THAN (1219089600),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE new (a TIMESTAMP, b TIMESTAMP)
|
||||
PARTITION BY RANGE (UNIX_TIMESTAMP(a + b)) (
|
||||
PARTITION p VALUES LESS THAN (1219089600),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
ALTER TABLE old MODIFY b TIMESTAMP;
|
||||
ALTER TABLE old
|
||||
PARTITION BY RANGE (UNIX_TIMESTAMP(a + b)) (
|
||||
PARTITION p VALUES LESS THAN (1219089600),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
DROP TABLE old;
|
||||
End of 5.1 tests
|
||||
|
Reference in New Issue
Block a user