summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/partition.result4
-rw-r--r--mysql-test/r/partition_mgm_err.result4
-rw-r--r--mysql-test/t/partition.test9
-rw-r--r--mysql-test/t/partition_mgm_err.test4
-rw-r--r--sql/sql_partition.cc7
5 files changed, 26 insertions, 2 deletions
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
index 80942c861fe..cdcaccbdd41 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -428,4 +428,8 @@ partition by list (a)
alter table t1 rebuild partition;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
drop table t1;
+create table t1 (a int)
+partition by hash (a)
+(partition p0 (subpartition sp0));
+ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
End of 5.1 tests
diff --git a/mysql-test/r/partition_mgm_err.result b/mysql-test/r/partition_mgm_err.result
index c7003c6e14c..f899801e7cd 100644
--- a/mysql-test/r/partition_mgm_err.result
+++ b/mysql-test/r/partition_mgm_err.result
@@ -141,7 +141,9 @@ DROP TABLE t1;
CREATE TABLE t1 (a INT) PARTITION BY HASH(a);
ALTER TABLE t1 ADD PARTITION PARTITIONS 4;
DROP TABLE t1;
-CREATE TABLE t1 (s1 int, s2 int) PARTITION BY LIST (s1) (
+CREATE TABLE t1 (s1 int, s2 int)
+PARTITION BY LIST (s1)
+SUBPARTITION BY KEY (s2) (
PARTITION p1 VALUES IN (0) (SUBPARTITION p1b),
PARTITION p2 VALUES IN (2) (SUBPARTITION p1b)
);
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
index 8fc46490856..3384e2a9f0f 100644
--- a/mysql-test/t/partition.test
+++ b/mysql-test/t/partition.test
@@ -552,4 +552,13 @@ alter table t1 rebuild partition;
drop table t1;
+#
+# BUG 15961 No error when subpartition defined without subpartition by clause
+#
+--error ER_SUBPARTITION_ERROR
+create table t1 (a int)
+partition by hash (a)
+(partition p0 (subpartition sp0));
+
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/partition_mgm_err.test b/mysql-test/t/partition_mgm_err.test
index f72222feadd..8573fd59f2f 100644
--- a/mysql-test/t/partition_mgm_err.test
+++ b/mysql-test/t/partition_mgm_err.test
@@ -205,7 +205,9 @@ DROP TABLE t1;
#BUG 15408: Partitions: subpartition names are not unique
#
--error ER_SAME_NAME_PARTITION
-CREATE TABLE t1 (s1 int, s2 int) PARTITION BY LIST (s1) (
+CREATE TABLE t1 (s1 int, s2 int)
+PARTITION BY LIST (s1)
+SUBPARTITION BY KEY (s2) (
PARTITION p1 VALUES IN (0) (SUBPARTITION p1b),
PARTITION p2 VALUES IN (2) (SUBPARTITION p1b)
);
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 014d3616d3d..d0d600c2e81 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -692,6 +692,13 @@ bool check_partition_info(partition_info *part_info,handlerton **eng_type,
char *same_name;
DBUG_ENTER("check_partition_info");
+ if (unlikely(!part_info->is_sub_partitioned() &&
+ !(part_info->use_default_subpartitions &&
+ part_info->use_default_no_subpartitions)))
+ {
+ my_error(ER_SUBPARTITION_ERROR, MYF(0));
+ goto end;
+ }
if (unlikely(part_info->is_sub_partitioned() &&
(!(part_info->part_type == RANGE_PARTITION ||
part_info->part_type == LIST_PARTITION))))