Commit 99e95e8d authored by Mattias Jonsson's avatar Mattias Jonsson

merge

parents 4e8ba083 945f6faa
......@@ -1778,7 +1778,7 @@ c1 bigint,
c2 set('sweet'),
key (c2,c1,c0),
key(c0)
) engine=myisam partition by hash (month(c0)) partitions 5;
) engine=myisam partition by hash (c0) partitions 5;
insert ignore into t1 set c0 = -6502262, c1 = 3992917, c2 = 35019;
insert ignore into t1 set c0 = 241221, c1 = -6862346, c2 = 56644;
select c1 from t1 group by (select c0 from t1 limit 1);
......
drop table if exists t1;
#
# Bug#54483: valgrind errors when making warnings for multiline inserts
# into partition
#
CREATE TABLE t1 (a VARBINARY(10))
PARTITION BY RANGE (DAYOFWEEK(a))
(PARTITION a1 VALUES LESS THAN (60));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a CHAR(10))
PARTITION BY RANGE (DAYOFWEEK(a))
(PARTITION a1 VALUES LESS THAN (60));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY RANGE (DAYOFWEEK(a))
(PARTITION a1 VALUES LESS THAN (60));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIMESTAMP)
PARTITION BY RANGE (DAYOFWEEK(a))
(PARTITION a1 VALUES LESS THAN (60));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATE)
PARTITION BY RANGE (DAYOFWEEK(a))
(PARTITION a1 VALUES LESS THAN (60));
INSERT INTO t1 VALUES ('test'),('a'),('5');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
Warning 1265 Data truncated for column 'a' at row 2
Warning 1265 Data truncated for column 'a' at row 3
SHOW WARNINGS;
Level Code Message
Warning 1265 Data truncated for column 'a' at row 1
Warning 1265 Data truncated for column 'a' at row 2
Warning 1265 Data truncated for column 'a' at row 3
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME)
PARTITION BY RANGE (DAYOFWEEK(a))
(PARTITION a1 VALUES LESS THAN (60));
INSERT INTO t1 VALUES ('test'),('a'),('5');
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Warning 1264 Out of range value for column 'a' at row 2
Warning 1264 Out of range value for column 'a' at row 3
SHOW WARNINGS;
Level Code Message
Warning 1264 Out of range value for column 'a' at row 1
Warning 1264 Out of range value for column 'a' at row 2
Warning 1264 Out of range value for column 'a' at row 3
DROP TABLE t1;
CREATE TABLE t1 (a TIME)
PARTITION BY RANGE (DAYOFWEEK(a))
(PARTITION a1 VALUES LESS THAN (60));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
SHOW WARNINGS;
Level Code Message
Error 1486 Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (TO_DAYS(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (TO_DAYS(a));
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (TO_DAYS(a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (TO_DAYS(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (TO_DAYS(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (DAYOFMONTH(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (DAYOFMONTH(a));
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (DAYOFMONTH(a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (DAYOFMONTH(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (DAYOFMONTH(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (MONTH(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (MONTH(a));
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (MONTH(a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (MONTH(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (MONTH(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (DAYOFYEAR(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (DAYOFYEAR(a));
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (DAYOFYEAR(a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (DAYOFYEAR(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (DAYOFYEAR(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (HOUR(a));
DROP TABLE t1;
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (HOUR(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (HOUR(a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (HOUR(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (HOUR(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (MINUTE(a));
DROP TABLE t1;
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (MINUTE(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (MINUTE(a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (MINUTE(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (MINUTE(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (QUARTER(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (QUARTER(a));
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (QUARTER(a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (QUARTER(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (QUARTER(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (SECOND(a));
DROP TABLE t1;
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (SECOND(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (SECOND(a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (SECOND(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (SECOND(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (YEARWEEK(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (YEARWEEK(a));
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (YEARWEEK(a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (YEARWEEK(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (YEARWEEK(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (WEEKDAY(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (WEEKDAY(a));
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (WEEKDAY(a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (WEEKDAY(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (WEEKDAY(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
# TO_SECONDS() is added in 5.5.
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (TO_SECONDS(a));
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')' at line 2
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (TIME_TO_SEC(a));
DROP TABLE t1;
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (TIME_TO_SEC(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (TIME_TO_SEC(a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (TIME_TO_SEC(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (TIME_TO_SEC(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (FROM_DAYS(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (FROM_DAYS(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (FROM_DAYS(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (TO_DAYS(FROM_DAYS(a)));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (FROM_DAYS(a));
ERROR HY000: The PARTITION function returns the wrong type
CREATE TABLE t1 (a INT)
PARTITION BY HASH (TO_DAYS(FROM_DAYS(a)));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (FROM_DAYS(a));
ERROR HY000: The PARTITION function returns the wrong type
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (MICROSECOND(a));
DROP TABLE t1;
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (MICROSECOND(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (MICROSECOND(a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (MICROSECOND(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (MICROSECOND(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
# Bug#57071
CREATE TABLE t1
(`date` date,
`extracted_week` int,
`yearweek` int,
`week` int,
`default_week_format` int)
PARTITION BY LIST (EXTRACT(WEEK FROM date) % 3)
(PARTITION p0 VALUES IN (0),
PARTITION p1 VALUES IN (1),
PARTITION p2 VALUES IN (2));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1
(`date` date,
`extracted_week` int,
`yearweek` int,
`week` int,
`default_week_format` int);
SET @old_default_week_format := @@default_week_format;
SET default_week_format = 0;
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
SET default_week_format = 1;
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
SET default_week_format = 2;
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
SET default_week_format = 3;
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
SET default_week_format = 4;
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
SET default_week_format = 5;
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
SET default_week_format = 6;
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
SET default_week_format = 7;
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
SELECT * FROM t1;
date extracted_week yearweek week default_week_format
2000-01-01 0 199952 0 0
2000-01-01 0 199952 0 1
2000-01-01 52 199952 52 2
2000-01-01 52 199952 52 3
2000-01-01 0 199952 0 4
2000-01-01 0 199952 0 5
2000-01-01 52 199952 52 6
2000-01-01 52 199952 52 7
SET default_week_format = @old_default_week_format;
DROP TABLE t1;
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(YEAR FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(YEAR FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(YEAR FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(YEAR FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(YEAR FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(QUARTER FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(QUARTER FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(QUARTER FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(QUARTER FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(QUARTER FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(MONTH FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(MONTH FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(MONTH FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(MONTH FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(MONTH FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
# EXTRACT(WEEK...) is disallowed, see bug#57071.
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(WEEK FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(WEEK FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(WEEK FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(WEEK FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(WEEK FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(DAY FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(DAY FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(DAY FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(DAY FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(DAY FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(HOUR FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(HOUR FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(HOUR FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(HOUR FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(HOUR FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(MINUTE FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(MINUTE FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(MINUTE FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(MINUTE FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(MINUTE FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(SECOND FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(SECOND FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(SECOND FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(SECOND FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(SECOND FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME, b DATE)
PARTITION BY HASH (DATEDIFF(a, b));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATE, b DATETIME)
PARTITION BY HASH (DATEDIFF(a, b));
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME, b DATE)
PARTITION BY HASH (DATEDIFF(a, b));
DROP TABLE t1;
CREATE TABLE t1 (a DATE, b VARCHAR(10))
PARTITION BY HASH (DATEDIFF(a, b));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT, b DATETIME)
PARTITION BY HASH (DATEDIFF(a, b));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (TIME_TO_SEC(a));
DROP TABLE t1;
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (TIME_TO_SEC(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (TIME_TO_SEC(a));
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (TIME_TO_SEC(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (a INT)
PARTITION BY HASH (TIME_TO_SEC(a));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
#
# Bug#49161: Out of memory; restart server and try again (needed 2 bytes)
#
CREATE TABLE t1 (a INT) PARTITION BY HASH (a);
......
......@@ -88,8 +88,9 @@ let $val2 = '2006-01-17';
let $val3 = '2006-02-25';
let $val4 = '2006-02-05';
--source suite/parts/inc/partition_supported_sql_funcs.inc
let $coltype = char(30);
--source suite/parts/inc/partition_supported_sql_funcs.inc
# Disabled after fixing bug#54483.
#let $coltype = char(30);
#--source suite/parts/inc/partition_supported_sql_funcs.inc
let $sqlfunc = extract(month from col1);
let $valsqlfunc = extract(year from '1998-11-23');
......@@ -139,8 +140,9 @@ let $val2 = '14:30:20';
let $val3 = '21:59:22';
let $val4 = '10:22:33';
--source suite/parts/inc/partition_supported_sql_funcs.inc
let $coltype = char(30);
--source suite/parts/inc/partition_supported_sql_funcs.inc
# second(non_time_col) is disabled after bug#54483.
#let $coltype = char(30);
#--source suite/parts/inc/partition_supported_sql_funcs.inc
let $sqlfunc = month(col1);
let $valsqlfunc = month('2006-10-14');
......@@ -172,26 +174,28 @@ let $val3 = '21:59:22';
let $val4 = '10:33:11';
--source suite/parts/inc/partition_supported_sql_funcs.inc
let $sqlfunc = to_days(col1)-to_days('2006-01-01');
let $valsqlfunc = to_days('2006-02-02')-to_days('2006-01-01');
let $coltype = date;
let $infile = part_supported_sql_funcs_int_date.inc;
let $val1 = '2006-02-03';
let $val2 = '2006-01-17';
let $val3 = '2006-01-25';
let $val4 = '2006-02-06';
--source suite/parts/inc/partition_supported_sql_funcs.inc
# to_days(non_date_col) is disabled after bug#54483.
#let $sqlfunc = to_days(col1)-to_days('2006-01-01');
#let $valsqlfunc = to_days('2006-02-02')-to_days('2006-01-01');
#let $coltype = date;
#let $infile = part_supported_sql_funcs_int_date.inc;
#let $val1 = '2006-02-03';
#let $val2 = '2006-01-17';
#let $val3 = '2006-01-25';
#let $val4 = '2006-02-06';
#--source suite/parts/inc/partition_supported_sql_funcs.inc
# to_days(non_date_col) is disabled after bug#54483.
# DATEDIFF() is implemented as (TO_DAYS(d1) - TO_DAYS(d2))
let $sqlfunc = datediff(col1, '2006-01-01');
let $valsqlfunc = datediff('2006-02-02', '2006-01-01');
let $coltype = date;
let $infile = part_supported_sql_funcs_int_date.inc;
let $val1 = '2006-02-03';
let $val2 = '2006-01-17';
let $val3 = '2006-01-25';
let $val4 = '2006-02-06';
--source suite/parts/inc/partition_supported_sql_funcs.inc
#let $sqlfunc = datediff(col1, '2006-01-01');
#let $valsqlfunc = datediff('2006-02-02', '2006-01-01');
#let $coltype = date;
#let $infile = part_supported_sql_funcs_int_date.inc;
#let $val1 = '2006-02-03';
#let $val2 = '2006-01-17';
#let $val3 = '2006-01-25';
#let $val4 = '2006-02-06';
#--source suite/parts/inc/partition_supported_sql_funcs.inc
let $sqlfunc = weekday(col1);
let $valsqlfunc = weekday('2006-10-14');
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -1821,15 +1821,16 @@ while ($cnt)
drop table t1;
#
# BUG#32272: partition crash 1: enum column
# BUG#32772: partition crash 1: enum column
#
# Note that month(int_col) is disallowed after bug#54483.
create table t1 (
c0 int,
c1 bigint,
c2 set('sweet'),
key (c2,c1,c0),
key(c0)
) engine=myisam partition by hash (month(c0)) partitions 5;
) engine=myisam partition by hash (c0) partitions 5;
--disable_warnings
insert ignore into t1 set c0 = -6502262, c1 = 3992917, c2 = 35019;
......
......@@ -10,6 +10,670 @@ drop table if exists t1;
let $MYSQLD_DATADIR= `SELECT @@datadir`;
--echo #
--echo # Bug#54483: valgrind errors when making warnings for multiline inserts
--echo # into partition
--echo #
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARBINARY(10))
PARTITION BY RANGE (DAYOFWEEK(a))
(PARTITION a1 VALUES LESS THAN (60));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a CHAR(10))
PARTITION BY RANGE (DAYOFWEEK(a))
(PARTITION a1 VALUES LESS THAN (60));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY RANGE (DAYOFWEEK(a))
(PARTITION a1 VALUES LESS THAN (60));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a TIMESTAMP)
PARTITION BY RANGE (DAYOFWEEK(a))
(PARTITION a1 VALUES LESS THAN (60));
CREATE TABLE t1 (a DATE)
PARTITION BY RANGE (DAYOFWEEK(a))
(PARTITION a1 VALUES LESS THAN (60));
INSERT INTO t1 VALUES ('test'),('a'),('5');
SHOW WARNINGS;
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME)
PARTITION BY RANGE (DAYOFWEEK(a))
(PARTITION a1 VALUES LESS THAN (60));
INSERT INTO t1 VALUES ('test'),('a'),('5');
SHOW WARNINGS;
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a TIME)
PARTITION BY RANGE (DAYOFWEEK(a))
(PARTITION a1 VALUES LESS THAN (60));
SHOW WARNINGS;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (TO_DAYS(a));
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (TO_DAYS(a));
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (TO_DAYS(a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (TO_DAYS(a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (TO_DAYS(a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (DAYOFMONTH(a));
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (DAYOFMONTH(a));
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (DAYOFMONTH(a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (DAYOFMONTH(a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (DAYOFMONTH(a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (MONTH(a));
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (MONTH(a));
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (MONTH(a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (MONTH(a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (MONTH(a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (DAYOFYEAR(a));
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (DAYOFYEAR(a));
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (DAYOFYEAR(a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (DAYOFYEAR(a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (DAYOFYEAR(a));
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (HOUR(a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (HOUR(a));
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (HOUR(a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (HOUR(a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (HOUR(a));
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (MINUTE(a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (MINUTE(a));
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (MINUTE(a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (MINUTE(a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (MINUTE(a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (QUARTER(a));
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (QUARTER(a));
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (QUARTER(a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (QUARTER(a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (QUARTER(a));
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (SECOND(a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (SECOND(a));
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (SECOND(a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (SECOND(a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (SECOND(a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (YEARWEEK(a));
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (YEARWEEK(a));
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (YEARWEEK(a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (YEARWEEK(a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (YEARWEEK(a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (WEEKDAY(a));
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (WEEKDAY(a));
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (WEEKDAY(a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (WEEKDAY(a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (WEEKDAY(a));
--echo # TO_SECONDS() is added in 5.5.
--error ER_PARSE_ERROR
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (TO_SECONDS(a));
#--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
#CREATE TABLE t1 (a TIME)
#PARTITION BY HASH (TO_SECONDS(a));
#CREATE TABLE t1 (a DATE)
#PARTITION BY HASH (TO_SECONDS(a));
#DROP TABLE t1;
#CREATE TABLE t1 (a DATETIME)
#PARTITION BY HASH (TO_SECONDS(a));
#DROP TABLE t1;
#--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
#CREATE TABLE t1 (a VARCHAR(10))
#PARTITION BY HASH (TO_SECONDS(a));
#--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
#CREATE TABLE t1 (a INT)
#PARTITION BY HASH (TO_SECONDS(a));
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (TIME_TO_SEC(a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (TIME_TO_SEC(a));
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (TIME_TO_SEC(a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (TIME_TO_SEC(a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (TIME_TO_SEC(a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (FROM_DAYS(a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (FROM_DAYS(a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (FROM_DAYS(a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (TO_DAYS(FROM_DAYS(a)));
--error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (FROM_DAYS(a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (TO_DAYS(FROM_DAYS(a)));
--error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (FROM_DAYS(a));
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (MICROSECOND(a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (MICROSECOND(a));
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (MICROSECOND(a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (MICROSECOND(a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (MICROSECOND(a));
--echo # Bug#57071
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1
(`date` date,
`extracted_week` int,
`yearweek` int,
`week` int,
`default_week_format` int)
PARTITION BY LIST (EXTRACT(WEEK FROM date) % 3)
(PARTITION p0 VALUES IN (0),
PARTITION p1 VALUES IN (1),
PARTITION p2 VALUES IN (2));
CREATE TABLE t1
(`date` date,
`extracted_week` int,
`yearweek` int,
`week` int,
`default_week_format` int);
SET @old_default_week_format := @@default_week_format;
SET default_week_format = 0;
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
SET default_week_format = 1;
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
SET default_week_format = 2;
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
SET default_week_format = 3;
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
SET default_week_format = 4;
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
SET default_week_format = 5;
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
SET default_week_format = 6;
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
SET default_week_format = 7;
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
SELECT * FROM t1;
SET default_week_format = @old_default_week_format;
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(YEAR FROM a));
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(YEAR FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(YEAR FROM a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(YEAR FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(YEAR FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(QUARTER FROM a));
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(QUARTER FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(QUARTER FROM a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(QUARTER FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(QUARTER FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(MONTH FROM a));
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(MONTH FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(MONTH FROM a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(MONTH FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(MONTH FROM a));
--echo # EXTRACT(WEEK...) is disallowed, see bug#57071.
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(WEEK FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(WEEK FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(WEEK FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(WEEK FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(WEEK FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(DAY FROM a));
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(DAY FROM a));
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(DAY FROM a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(DAY FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(DAY FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(HOUR FROM a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(HOUR FROM a));
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(HOUR FROM a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(HOUR FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(HOUR FROM a));
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(MINUTE FROM a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(MINUTE FROM a));
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(MINUTE FROM a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(MINUTE FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(MINUTE FROM a));
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(SECOND FROM a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(SECOND FROM a));
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(SECOND FROM a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(SECOND FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(SECOND FROM a));
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a TIME, b DATE)
PARTITION BY HASH (DATEDIFF(a, b));
CREATE TABLE t1 (a DATE, b DATETIME)
PARTITION BY HASH (DATEDIFF(a, b));
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME, b DATE)
PARTITION BY HASH (DATEDIFF(a, b));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a DATE, b VARCHAR(10))
PARTITION BY HASH (DATEDIFF(a, b));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT, b DATETIME)
PARTITION BY HASH (DATEDIFF(a, b));
CREATE TABLE t1 (a TIME)
PARTITION BY HASH (TIME_TO_SEC(a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a DATE)
PARTITION BY HASH (TIME_TO_SEC(a));
CREATE TABLE t1 (a DATETIME)
PARTITION BY HASH (TIME_TO_SEC(a));
DROP TABLE t1;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a VARCHAR(10))
PARTITION BY HASH (TIME_TO_SEC(a));
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (a INT)
PARTITION BY HASH (TIME_TO_SEC(a));
--echo #
--echo # Bug#49161: Out of memory; restart server and try again (needed 2 bytes)
--echo #
......
......@@ -966,11 +966,11 @@ class Item {
virtual bool set_no_const_sub(uchar *arg) { return FALSE; }
virtual Item *replace_equal_field(uchar * arg) { return this; }
/*
Check if an expression value depends on the current timezone. Used by
partitioning code to reject timezone-dependent expressions in a
(sub)partitioning function.
Check if an expression value has allowed arguments, like DATE/DATETIME
for date functions. Also used by partitioning code to reject
timezone-dependent expressions in a (sub)partitioning function.
*/
virtual bool is_timezone_dependent_processor(uchar *bool_arg)
virtual bool check_valid_arguments_processor(uchar *bool_arg)
{
return FALSE;
}
......
......@@ -189,6 +189,7 @@ class Item_func :public Item_result_field
null_value=1;
return 0.0;
}
bool has_timestamp_args()
{
DBUG_ASSERT(fixed == TRUE);
......@@ -200,6 +201,45 @@ class Item_func :public Item_result_field
}
return FALSE;
}
bool has_date_args()
{
DBUG_ASSERT(fixed == TRUE);
for (uint i= 0; i < arg_count; i++)
{
if (args[i]->type() == Item::FIELD_ITEM &&
(args[i]->field_type() == MYSQL_TYPE_DATE ||
args[i]->field_type() == MYSQL_TYPE_DATETIME))
return TRUE;
}
return FALSE;
}
bool has_time_args()
{
DBUG_ASSERT(fixed == TRUE);
for (uint i= 0; i < arg_count; i++)
{
if (args[i]->type() == Item::FIELD_ITEM &&
(args[i]->field_type() == MYSQL_TYPE_TIME ||
args[i]->field_type() == MYSQL_TYPE_DATETIME))
return TRUE;
}
return FALSE;
}
bool has_datetime_args()
{
DBUG_ASSERT(fixed == TRUE);
for (uint i= 0; i < arg_count; i++)
{
if (args[i]->type() == Item::FIELD_ITEM &&
args[i]->field_type() == MYSQL_TYPE_DATETIME)
return TRUE;
}
return FALSE;
}
/*
We assume the result of any function that has a TIMESTAMP argument to be
timezone-dependent, since a TIMESTAMP value in both numeric and string
......@@ -208,7 +248,7 @@ class Item_func :public Item_result_field
representation of a TIMESTAMP argument verbatim, and thus does not depend on
the timezone.
*/
virtual bool is_timezone_dependent_processor(uchar *bool_arg)
virtual bool check_valid_arguments_processor(uchar *bool_arg)
{
return has_timestamp_args();
}
......
......@@ -70,6 +70,10 @@ class Item_func_to_days :public Item_int_func
enum_monotonicity_info get_monotonicity_info() const;
longlong val_int_endpoint(bool left_endp, bool *incl_endp);
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_valid_arguments_processor(uchar *int_arg)
{
return !has_date_args();
}
};
......@@ -86,6 +90,10 @@ class Item_func_dayofmonth :public Item_int_func
maybe_null=1;
}
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_valid_arguments_processor(uchar *int_arg)
{
return !has_date_args();
}
};
......@@ -111,6 +119,10 @@ class Item_func_month :public Item_func
maybe_null=1;
}
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_valid_arguments_processor(uchar *int_arg)
{
return !has_date_args();
}
};
......@@ -140,6 +152,10 @@ class Item_func_dayofyear :public Item_int_func
maybe_null=1;
}
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_valid_arguments_processor(uchar *int_arg)
{
return !has_date_args();
}
};
......@@ -156,6 +172,10 @@ class Item_func_hour :public Item_int_func
maybe_null=1;
}
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_valid_arguments_processor(uchar *int_arg)
{
return !has_time_args();
}
};
......@@ -172,6 +192,10 @@ class Item_func_minute :public Item_int_func
maybe_null=1;
}
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_valid_arguments_processor(uchar *int_arg)
{
return !has_time_args();
}
};
......@@ -188,6 +212,10 @@ class Item_func_quarter :public Item_int_func
maybe_null=1;
}
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_valid_arguments_processor(uchar *int_arg)
{
return !has_date_args();
}
};
......@@ -204,6 +232,10 @@ class Item_func_second :public Item_int_func
maybe_null=1;
}
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_valid_arguments_processor(uchar *int_arg)
{
return !has_time_args();
}
};
......@@ -234,6 +266,10 @@ class Item_func_yearweek :public Item_int_func
maybe_null=1;
}
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_valid_arguments_processor(uchar *int_arg)
{
return !has_date_args();
}
};
......@@ -252,6 +288,10 @@ class Item_func_year :public Item_int_func
maybe_null=1;
}
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_valid_arguments_processor(uchar *int_arg)
{
return !has_date_args();
}
};
......@@ -282,6 +322,10 @@ class Item_func_weekday :public Item_func
maybe_null=1;
}
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_valid_arguments_processor(uchar *int_arg)
{
return !has_date_args();
}
};
class Item_func_dayname :public Item_func_weekday
......@@ -311,7 +355,7 @@ class Item_func_unix_timestamp :public Item_int_func
(and thus may not be used as a partitioning function)
when its argument is NOT of the TIMESTAMP type.
*/
bool is_timezone_dependent_processor(uchar *int_arg)
bool check_valid_arguments_processor(uchar *int_arg)
{
return !has_timestamp_args();
}
......@@ -336,6 +380,10 @@ class Item_func_time_to_sec :public Item_int_func
max_length=10*MY_CHARSET_BIN_MB_MAXLEN;
}
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_valid_arguments_processor(uchar *int_arg)
{
return !has_time_args();
}
};
......@@ -589,6 +637,10 @@ class Item_func_from_days :public Item_date
const char *func_name() const { return "from_days"; }
bool get_date(MYSQL_TIME *res, uint fuzzy_date);
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_valid_arguments_processor(uchar *int_arg)
{
return has_date_args() || has_time_args();
}
};
......@@ -715,6 +767,42 @@ class Item_extract :public Item_int_func
bool eq(const Item *item, bool binary_cmp) const;
virtual void print(String *str, enum_query_type query_type);
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_valid_arguments_processor(uchar *int_arg)
{
switch (int_type) {
case INTERVAL_YEAR:
case INTERVAL_YEAR_MONTH:
case INTERVAL_QUARTER:
case INTERVAL_MONTH:
/* case INTERVAL_WEEK: Not allowed as partitioning function, bug#57071 */
case INTERVAL_DAY:
return !has_date_args();
case INTERVAL_DAY_HOUR:
case INTERVAL_DAY_MINUTE:
case INTERVAL_DAY_SECOND:
case INTERVAL_DAY_MICROSECOND:
return !has_datetime_args();
case INTERVAL_HOUR:
case INTERVAL_HOUR_MINUTE:
case INTERVAL_HOUR_SECOND:
case INTERVAL_MINUTE:
case INTERVAL_MINUTE_SECOND:
case INTERVAL_SECOND:
case INTERVAL_MICROSECOND:
case INTERVAL_HOUR_MICROSECOND:
case INTERVAL_MINUTE_MICROSECOND:
case INTERVAL_SECOND_MICROSECOND:
return !has_time_args();
default:
/*
INTERVAL_LAST is only an end marker,
INTERVAL_WEEK depends on default_week_format which is a session
variable and cannot be used for partitioning. See bug#57071.
*/
break;
}
return true;
}
};
......@@ -965,6 +1053,10 @@ class Item_func_microsecond :public Item_int_func
maybe_null=1;
}
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_valid_arguments_processor(uchar *int_arg)
{
return !has_time_args();
}
};
......
......@@ -1014,12 +1014,13 @@ static bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table,
}
/*
We don't allow creating partitions with timezone-dependent expressions as
a (sub)partitioning function, but we want to allow such expressions when
opening existing tables for easier maintenance. This exception should be
deprecated at some point in future so that we always throw an error.
We don't allow creating partitions with expressions with non matching
arguments as a (sub)partitioning function,
but we want to allow such expressions when opening existing tables for
easier maintenance. This exception should be deprecated at some point
in future so that we always throw an error.
*/
if (func_expr->walk(&Item::is_timezone_dependent_processor,
if (func_expr->walk(&Item::check_valid_arguments_processor,
0, NULL))
{
if (is_create_table_ind)
......
......@@ -1867,8 +1867,8 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
{
if (work_part_info_used)
tmp= fix_partition_func(thd, outparam, is_create_table);
outparam->part_info->item_free_list= part_func_arena.free_list;
}
outparam->part_info->item_free_list= part_func_arena.free_list;
partititon_err:
if (tmp)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment