summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2017-02-02 13:52:33 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2017-02-07 15:24:24 +0100
commit2d6c826ba1dec1bf4ed8f315003ae7775bbb1d5d (patch)
treefe446805ef8ed86579149eb2678a7ce297d95c65
parentabe6aca8d46a570a46904ef95e77148ad2270518 (diff)
downloadmariadb-git-bb-10.2-MDEV-11681.tar.gz
MDEV-11681: PARTITION BY LIST COLUMNS with default partition: Assertion `part_info->num_list_values' failed in get_part_iter_for_interval_cols_via_mapbb-10.2-MDEV-11681
process adge case with only default partition
-rw-r--r--mysql-test/r/partition_list.result24
-rw-r--r--mysql-test/t/partition_list.test23
-rw-r--r--sql/sql_partition.cc3
3 files changed, 50 insertions, 0 deletions
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;