summaryrefslogtreecommitdiff
path: root/sql/partition_info.cc
diff options
context:
space:
mode:
authormikael/pappa@dator5.(none) <>2006-07-12 11:33:22 -0400
committermikael/pappa@dator5.(none) <>2006-07-12 11:33:22 -0400
commiteae8c963c5ee3a9b88164cc971ecfd12ebff05dd (patch)
treec3d9a5a489a6a7dc750b00cf189b565d4a6f3597 /sql/partition_info.cc
parent4e23f9756db632803342705e5f2bbfc979d6cb01 (diff)
parentd6d6783b6a0e1131ab3c66513cc9dd56ba7f8b68 (diff)
downloadmariadb-git-eae8c963c5ee3a9b88164cc971ecfd12ebff05dd.tar.gz
Merge mronstrom@bk-internal.mysql.com:/home/bk/bugs/bug18198
into dator5.(none):/home/pappa/bug18198
Diffstat (limited to 'sql/partition_info.cc')
-rw-r--r--sql/partition_info.cc37
1 files changed, 26 insertions, 11 deletions
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index 286637bd9aa..94008e621c7 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,40 @@ 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;
+ 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;
+ }
+ 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)))