Description:
Found in the tests when building version 5.1.21
Several tests in the "parts" suite fail with error
1561: This partition function is not allowed
at places where this is not expected.
It seems that the discussion in bug#18198 contains the valid restrictions,
the fix for this bug is contained in the sources of 5.1.21
-------------------------------------------------------
*** /PATH/mysql-test/suite/parts/r/part_blocked_sql_func_innodb.result
--- /PATH/mysql-test/suite/parts/r/part_blocked_sql_func_innodb.reject
***************
*** 15,27
--- 15,30
partition by range(greatest(col1,15))
(partition p0 values less than (15),
partition p1 values less than (31));
+ ERROR HY000: This partition function is not allowed
create table t2 (col1 int) engine='INNODB'
partition by list(greatest(col1,15))
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
partition p2 values in (21,22,23,24,25,26,27,28,29,30));
+ ERROR HY000: This partition function is not allowed
create table t3 (col1 int) engine='INNODB'
partition by hash(greatest(col1,15));
+ ERROR HY000: This partition function is not allowed
create table t4 (colint int, col1 int) engine='INNODB'
partition by range(colint)
subpartition by hash(greatest(col1,15)) subpartitions 2
***************
.....
-------------------------------------------------------
*** /PATH/mysql-test/suite/parts/r/part_blocked_sql_func_myisam.result
--- /PATH/mysql-test/suite/parts/r/part_blocked_sql_func_myisam.reject
***************
((similar))
parts.partition_alter3_innodb [ fail ]
Errors are (from /PATH/mysqltest-time) :
mysqltest: In included file "./suite/parts/inc/partition_alter3.inc": At line 46: query 'ALTER TABLE t1 PARTITION BY HASH(CAST(YEAR(f_date) AS SIGNED INTEGER))' failed: 1561: This partition function is not allowed
(the last lines may be the most important ones)
parts.partition_alter3_myisam [ fail ]
((similar))
parts.partition_datetime_innodb [ fail ]
Errors are (from /PATH/mysqltest-time) :
mysqltest: In included file "./suite/parts/inc/partition_timestamp.inc": At line 48: query 'create table t3 (a timestamp not null, primary key(a)) engine=$engine
partition by range (cast(month(a) as unsigned)) subpartition by key (a)
subpartitions 3 (
partition quarter1 values less than (4),
partition quarter2 values less than (7),
partition quarter3 values less than (10),
partition quarter4 values less than (13)
)' failed: 1561: This partition function is not allowed
(the last lines may be the most important ones)
parts.partition_datetime_myisam [ fail ]
((similar))
parts.partition_decimal_innodb [ fail ]
Errors are (from /PATH/mysqltest-time) :
mysqltest: In included file "./suite/parts/inc/partition_decimal.inc": At line 50: query 'create table t3 (a decimal(18,9)
not null, primary key(a)) engine=$engine
partition by range (cast(floor(a) as signed)) subpartition by key (a) subpartitions 2 (
partition pa2 values less than (2),
partition pa4 values less than (4),
partition pa6 values less than (6),
partition pa8 values less than (8),
partition pa10 values less than (10)
)' failed: 1561: This partition function is not allowed
(the last lines may be the most important ones)
parts.partition_decimal_myisam [ fail ]
((similar))
parts.partition_float_innodb [ fail ]
Errors are (from /PATH/mysqltest-time) :
mysqltest: In included file "./suite/parts/inc/partition_float.inc": At line 54: query 'create table t3 (a float not null,
primary key(a)) engine=$engine
partition by range (cast(floor(a) as signed)) subpartition by key (a) subpartitions 3 (
partition pa1 values less than (3),
partition pa3 values less than (6),
partition pa10 values less than (10)
)' failed: 1561: This partition function is not allowed
(the last lines may be the most important ones)
parts.partition_float_myisam [ fail ]
((similar))
parts.partition_syntax_innodb [ fail ]
Errors are (from /PATH/mysqltest-time) :
mysqltest: In included file "./suite/parts/inc/partition_syntax.inc": At line 336: query 'CREATE TABLE t1 (
$column_list
)
PARTITION BY RANGE(f_int1)
( PARTITION part1 VALUES LESS THAN (CAST(NULL AS SIGNED INTEGER)),
PARTITION part2 VALUES LESS THAN (1000))' failed with wrong errno 1561: 'This partition function is not allowed', instead of 1064...
(the last lines may be the most important ones)
parts.partition_syntax_myisam [ fail ]
((similar))
parts.partition_value_innodb [ fail ]
Errors are (from /PATH/mysqltest-time) :
mysqltest: In included file "./suite/parts/inc/partition_value.inc": At line 26: query 'CREATE TABLE t1 (
$column_list
)
PARTITION BY HASH(CAST(f_char1 AS SIGNED INTEGER) * CAST(5.0E+18 AS SIGNED INTEGER)) PARTITIONS 8' failed: 1561: This partition function is not allowed
(the last lines may be the most important ones)
parts.partition_value_myisam [ fail ]
((similar))
How to repeat:
Found by running the "parts" suite in the release build.
Suggested fix:
Check bug#18198 and modify the tests.