diff --git a/mysql-test/r/partition_list.result b/mysql-test/r/partition_list.result index e22fc11e5bb..2e95f882217 100644 --- a/mysql-test/r/partition_list.result +++ b/mysql-test/r/partition_list.result @@ -310,3 +310,27 @@ create table t1 (a char(1)) partition by list (ascii(ucase(a))) (partition p1 values in (2)); ERROR HY000: This partition function is not allowed +# +# MDEV-11681: PARTITION BY LIST COLUMNS with default partition: +# Assertion `part_info->num_list_values' failed in +# get_part_iter_for_interval_cols_via_map +# +CREATE TABLE t1 (f int) PARTITION BY LIST COLUMNS (f) (PARTITION pdef DEFAULT); +insert into t1 values (1),(2); +select * from t1 where f = 1; +f +1 +drop table t1; +CREATE TABLE t1 (f int, d int) PARTITION BY LIST COLUMNS (f,d) (PARTITION pdef DEFAULT); +insert into t1 values (1,1),(2,2); +select * from t1 where f = 1 and d = 1 ; +f d +1 1 +drop table t1; +CREATE TABLE t1 (f int) PARTITION BY LIST (f) (PARTITION pdef DEFAULT); +insert into t1 values (1),(2); +select * from t1 where f = 1; +f +1 +drop table t1; +#end of 10.2 tests diff --git a/mysql-test/t/partition_list.test b/mysql-test/t/partition_list.test index 8d2ec88e0f4..e2b6aff300f 100644 --- a/mysql-test/t/partition_list.test +++ b/mysql-test/t/partition_list.test @@ -186,3 +186,26 @@ create table t1 (a char(1)) partition by list (ascii(ucase(a))) (partition p1 values in (2)); +--echo # +--echo # MDEV-11681: PARTITION BY LIST COLUMNS with default partition: +--echo # Assertion `part_info->num_list_values' failed in +--echo # get_part_iter_for_interval_cols_via_map +--echo # +CREATE TABLE t1 (f int) PARTITION BY LIST COLUMNS (f) (PARTITION pdef DEFAULT); +insert into t1 values (1),(2); +select * from t1 where f = 1; + +drop table t1; + +CREATE TABLE t1 (f int, d int) PARTITION BY LIST COLUMNS (f,d) (PARTITION pdef DEFAULT); +insert into t1 values (1,1),(2,2); +select * from t1 where f = 1 and d = 1 ; + +drop table t1; +CREATE TABLE t1 (f int) PARTITION BY LIST (f) (PARTITION pdef DEFAULT); +insert into t1 values (1),(2); +select * from t1 where f = 1; + +drop table t1; + +--echo #end of 10.2 tests diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 972ab3aa1f1..4e71e792a08 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -7703,6 +7703,9 @@ int get_part_iter_for_interval_cols_via_map(partition_info *part_info, } else if (part_info->part_type == LIST_PARTITION) { + if (part_info->has_default_partititon() && + part_info->num_parts == 1) + DBUG_RETURN(-1); //only DEFAULT partition get_col_endpoint= get_partition_id_cols_list_for_endpoint; part_iter->get_next= get_next_partition_id_list; part_iter->part_info= part_info;