summaryrefslogtreecommitdiff
path: root/sql/partition_info.cc
diff options
context:
space:
mode:
authorunknown <mikael@dator5.(none)>2006-06-23 01:21:26 -0400
committerunknown <mikael@dator5.(none)>2006-06-23 01:21:26 -0400
commit604227e855b874b72541703f439b4b24f9cf142e (patch)
tree8a5d830c934165bdeafc31953e93b8856ce8e72f /sql/partition_info.cc
parent3856cdb89b3753bb56e56b2a8629a2dd8d2d3deb (diff)
downloadmariadb-git-604227e855b874b72541703f439b4b24f9cf142e.tar.gz
BUG#18198: Less flexibility in defining partition functions
Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations mysql-test/r/partition.result: Changed test case since no longer supported to use multicharacter collations in comparisons mysql-test/t/partition.test: Changed test case since no longer supported to use multicharacter collations in comparisons sql/item.h: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/item_cmpfunc.h: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/item_func.h: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/item_strfunc.h: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/item_timefunc.h: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/item_xmlfunc.h: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/partition_info.cc: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/partition_info.h: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/sql_partition.cc: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/sql_table.cc: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations
Diffstat (limited to 'sql/partition_info.cc')
-rw-r--r--sql/partition_info.cc39
1 files changed, 28 insertions, 11 deletions
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index 39c8d976732..502a0fb4eef 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -694,6 +694,7 @@ end:
file A reference to a handler of the table
max_rows Maximum number of rows stored in the table
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
@@ -708,26 +709,42 @@ end:
*/
bool partition_info::check_partition_info(THD *thd, handlerton **eng_type,
- handler *file, ulonglong max_rows)
+ handler *file, ulonglong max_rows,
+ 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;
+ int part_expression_ok= PF_SAFE;
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)
+ pf_collation_allowed= PF_SAFE;
+ spf_collation_allowed= PF_SAFE;
+ if (check_partition_function)
{
- my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0));
- goto end;
+ 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= (char)part_expression_ok;
+ part_expression_ok= PF_SAFE;
+ if (is_sub_partitioned() && !list_of_subpart_fields)
+ {
+ subpart_expr->walk(&Item::check_partition_func_processor, 0,
+ (byte*)(&part_expression_ok));
+ }
+ spf_collation_allowed= (char)part_expression_ok;
+ }
+ else
+ multi_char_collation_allowed= TRUE;
+ 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)))