summaryrefslogtreecommitdiff
path: root/sql/partition_info.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2017-11-20 09:33:19 +0400
committerAlexander Barkov <bar@mariadb.org>2017-11-20 09:33:19 +0400
commit9b53e541f03d74e2777e0d1e7618b6246b81c721 (patch)
tree669b60056a43fb77f6823c795ed5f8d221623411 /sql/partition_info.cc
parentc44ece7342f14498630e4ab403ae125971137457 (diff)
downloadmariadb-git-9b53e541f03d74e2777e0d1e7618b6246b81c721.tar.gz
MDEV-13788 Server crash when issuing bad SQL partition syntax
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 512bf296135..740e5087477 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -2132,6 +2132,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;
+}
+
+
/*
The parser generates generic data structures, we need to set them up
as the rest of the code expects to find them. This is in reality part
@@ -2221,6 +2239,8 @@ int 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);
for (j= 0; j < num_elements; j++)