diff options
author | unknown <mikael@dator5.(none)> | 2006-06-23 01:21:26 -0400 |
---|---|---|
committer | unknown <mikael@dator5.(none)> | 2006-06-23 01:21:26 -0400 |
commit | 604227e855b874b72541703f439b4b24f9cf142e (patch) | |
tree | 8a5d830c934165bdeafc31953e93b8856ce8e72f /sql/sql_partition.cc | |
parent | 3856cdb89b3753bb56e56b2a8629a2dd8d2d3deb (diff) | |
download | mariadb-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/sql_partition.cc')
-rw-r--r-- | sql/sql_partition.cc | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 00c15c2dbca..e0e73dda2b5 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -525,6 +525,7 @@ static bool set_up_field_array(TABLE *table, } + /* Create a field array including all fields of both the partitioning and the subpartitioning functions. @@ -549,6 +550,7 @@ static bool create_full_part_field_array(TABLE *table, partition_info *part_info) { bool result= FALSE; + Field **ptr; DBUG_ENTER("create_full_part_field_array"); if (!part_info->is_sub_partitioned()) @@ -558,7 +560,7 @@ static bool create_full_part_field_array(TABLE *table, } else { - Field **ptr, *field, **field_array; + Field *field, **field_array; uint no_part_fields=0, size_field_array; ptr= table->field; while ((field= *(ptr++))) @@ -1369,6 +1371,38 @@ static uint32 get_part_id_from_linear_hash(longlong hash_value, uint mask, return part_id; } + +/* + Check that partition function do not contain any forbidden + character sets and collations. + SYNOPSIS + check_part_func_collation() + part_info Partition info + ptr Array of Field pointers + RETURN VALUES + FALSE Success + TRUE Error +*/ + +static bool check_part_func_collation(int collation_allowed, + Field **ptr) +{ + Field *field; + while ((field= *(ptr++))) + { + if (field->result_type() == STRING_RESULT) + { + CHARSET_INFO *cs= ((Field_str*)field)->charset(); + if (use_strnxfrm(cs) || + (collation_allowed == PF_SAFE_BINARY_COLLATION && + (!(cs->state & MY_CS_BINSORT)))) + return TRUE; + } + } + return FALSE; +} + + /* fix partition functions @@ -1514,6 +1548,17 @@ bool fix_partition_func(THD *thd, TABLE *table, goto end; } } + if (((part_info->pf_collation_allowed != PF_SAFE) && + check_part_func_collation(part_info->pf_collation_allowed, + part_info->part_field_array)) || + (part_info->is_sub_partitioned() && + part_info->spf_collation_allowed != PF_SAFE && + check_part_func_collation(part_info->spf_collation_allowed, + part_info->subpart_field_array))) + { + my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0)); + goto end; + } if (unlikely(create_full_part_field_array(table, part_info))) goto end; if (unlikely(check_primary_key(table))) @@ -4545,7 +4590,7 @@ the generated partition syntax in a correct manner. tab_part_info->use_default_no_subpartitions= FALSE; } if (tab_part_info->check_partition_info(thd, (handlerton**)NULL, - table->file, ULL(0))) + table->file, ULL(0), FALSE)) { DBUG_RETURN(TRUE); } |