summaryrefslogtreecommitdiff
path: root/sql/partition_info.cc
diff options
context:
space:
mode:
authorunknown <mikael/pappa@dator5.(none)>2006-09-26 01:49:14 -0400
committerunknown <mikael/pappa@dator5.(none)>2006-09-26 01:49:14 -0400
commit2c9ab3a12a58e1796c08e3f298ef58ba9a77688d (patch)
tree1f0a46be173b4df3e9ff5093636ef2c6914a246c /sql/partition_info.cc
parent224e0b5f588e1c4ab51f528e570846e0c16a43ff (diff)
parent03b65beb5d3411d70ceed1a8b13433998451454e (diff)
downloadmariadb-git-2c9ab3a12a58e1796c08e3f298ef58ba9a77688d.tar.gz
Merge dator5.(none):/home/pappa/clean-mysql-5.1
into dator5.(none):/home/pappa/bug18198 mysql-test/r/partition.result: Auto merged mysql-test/r/partition_range.result: Auto merged mysql-test/t/partition_range.test: Auto merged sql/item_func.h: Auto merged sql/item_strfunc.h: Auto merged sql/partition_info.cc: Auto merged sql/sql_partition.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_yacc.yy: Auto merged mysql-test/t/partition.test: manual merge sql/item.h: manual merge sql/item_cmpfunc.h: manual merge
Diffstat (limited to 'sql/partition_info.cc')
-rw-r--r--sql/partition_info.cc38
1 files changed, 27 insertions, 11 deletions
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index 3e8ad9bb78b..ecf423f08b1 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -695,6 +695,7 @@ end:
file A reference to a handler of the table
info Create info
engine_type Return value for used engine in partitions
+ check_partition_function Should we check the partition function
RETURN VALUE
TRUE Error, something went wrong
@@ -709,26 +710,41 @@ end:
*/
bool partition_info::check_partition_info(THD *thd, handlerton **eng_type,
- handler *file, HA_CREATE_INFO *info)
+ handler *file, HA_CREATE_INFO *info,
+ bool check_partition_function)
{
handlerton **engine_array= NULL;
uint part_count= 0;
uint i, tot_partitions;
bool result= TRUE;
char *same_name;
- bool part_expression_ok= TRUE;
DBUG_ENTER("partition_info::check_partition_info");
- if (part_type != HASH_PARTITION || !list_of_part_fields)
- part_expr->walk(&Item::check_partition_func_processor, 0,
- (byte*)(&part_expression_ok));
- if (is_sub_partitioned() && !list_of_subpart_fields)
- subpart_expr->walk(&Item::check_partition_func_processor, 0,
- (byte*)(&part_expression_ok));
- if (!part_expression_ok)
+ if (check_partition_function)
{
- my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0));
- goto end;
+ int part_expression_ok= 1;
+ int pf_collation_allowed= 1;
+ int spf_collation_allowed= 1;
+
+ if (part_type != HASH_PARTITION || !list_of_part_fields)
+ {
+ part_expr->walk(&Item::check_partition_func_processor, 0,
+ (byte*)(&part_expression_ok));
+ pf_collation_allowed= part_expression_ok;
+ part_expression_ok= 1;
+ if (is_sub_partitioned() && !list_of_subpart_fields)
+ {
+ subpart_expr->walk(&Item::check_partition_func_processor, 0,
+ (byte*)(&part_expression_ok));
+ }
+ spf_collation_allowed= part_expression_ok;
+ }
+ if (!pf_collation_allowed ||
+ !spf_collation_allowed)
+ {
+ my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0));
+ goto end;
+ }
}
if (unlikely(!is_sub_partitioned() &&
!(use_default_subpartitions && use_default_no_subpartitions)))