diff --git a/mysql-test/r/ndb_partition_error2.result b/mysql-test/r/ndb_partition_error2.result new file mode 100644 index 00000000000..fd477306858 --- /dev/null +++ b/mysql-test/r/ndb_partition_error2.result @@ -0,0 +1,3 @@ +drop table if exists t1; +create table t1 (s1 int) engine=ndbcluster; +ERROR HY000: For the partitioned engine it is necessary to define all partition diff --git a/mysql-test/t/ndb_partition_error2-master.opt b/mysql-test/t/ndb_partition_error2-master.opt new file mode 100644 index 00000000000..955f7692c8b --- /dev/null +++ b/mysql-test/t/ndb_partition_error2-master.opt @@ -0,0 +1 @@ +--ndbcluster diff --git a/mysql-test/t/ndb_partition_error2.test b/mysql-test/t/ndb_partition_error2.test new file mode 100644 index 00000000000..afedd0e3c5c --- /dev/null +++ b/mysql-test/t/ndb_partition_error2.test @@ -0,0 +1,14 @@ +disable_query_log; +--require r/true.require +select support = 'Enabled' as `TRUE` from information_schema.engines where engine = 'ndbcluster'; +enable_query_log; + +--disable_warnings +drop table if exists t1; +--enable_warnings +# +# Bug #27359 Partitions: memory allocation error message +# +--error ER_PARTITION_NOT_DEFINED_ERROR +create table t1 (s1 int) engine=ndbcluster; + diff --git a/sql/partition_info.cc b/sql/partition_info.cc index a7f9bd413c6..39aa3a6db92 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -753,7 +753,11 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type, } if (unlikely(set_up_defaults_for_partitioning(file, info, (uint)0))) goto end; - tot_partitions= get_tot_partitions(); + if (!(tot_partitions= get_tot_partitions())) + { + my_error(ER_PARTITION_NOT_DEFINED_ERROR, MYF(0), "partitions"); + goto end; + } if (unlikely(tot_partitions > MAX_PARTITIONS)) { my_error(ER_TOO_MANY_PARTITIONS_ERROR, MYF(0));