summaryrefslogtreecommitdiff
path: root/sql/partition_info.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2018-01-01 19:39:59 +0200
committerMonty <monty@mariadb.org>2018-01-01 19:39:59 +0200
commitfbab79c9b8a58b90292e900cf46ab6d6632ebb68 (patch)
tree49738ad2561489954fa0973d82be10fafbf42e0b /sql/partition_info.cc
parentafbb72b3b6988f4c5242d46588754517724b2950 (diff)
parentaed2050e40cb332d54e8d40eb7242309b962c4e1 (diff)
downloadmariadb-git-fbab79c9b8a58b90292e900cf46ab6d6632ebb68.tar.gz
Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext
Conflicts: cmake/make_dist.cmake.in mysql-test/r/func_json.result mysql-test/r/ps.result mysql-test/t/func_json.test mysql-test/t/ps.test sql/item_cmpfunc.h
Diffstat (limited to 'sql/partition_info.cc')
-rw-r--r--sql/partition_info.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index 1224c1bf9f3..d721453a181 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -2383,6 +2383,24 @@ end:
DBUG_RETURN(result);
}
+
+bool partition_info::error_if_requires_values() const
+{
+ switch (part_type) {
+ case NOT_A_PARTITION:
+ case HASH_PARTITION:
+ break;
+ case RANGE_PARTITION:
+ my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0), "RANGE", "LESS THAN");
+ return true;
+ case LIST_PARTITION:
+ my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0), "LIST", "IN");
+ return true;
+ }
+ return false;
+}
+
+
/**
Fix partition data from parser.
@@ -2473,6 +2491,8 @@ bool partition_info::fix_parser_data(THD *thd)
part_elem= it++;
List_iterator<part_elem_value> list_val_it(part_elem->list_val_list);
num_elements= part_elem->list_val_list.elements;
+ if (!num_elements && error_if_requires_values())
+ DBUG_RETURN(true);
DBUG_ASSERT(part_type == RANGE_PARTITION ?
num_elements == 1U : TRUE);