diff options
author | Aleksey Midenkov <midenok@gmail.com> | 2018-01-10 12:36:55 +0300 |
---|---|---|
committer | Aleksey Midenkov <midenok@gmail.com> | 2018-01-10 12:36:55 +0300 |
commit | c59c1a0736e36e9c66f798d199a124f362353377 (patch) | |
tree | 80ee18faad049687b0b4f0e2f147caf870d68390 /sql/partition_info.cc | |
parent | 26971c9aea67a62f348cd105348a8dc4407bcf4a (diff) | |
parent | 0b597d3ab2494bc1db97cc4a30d697a5fdf48c21 (diff) | |
download | mariadb-git-c59c1a0736e36e9c66f798d199a124f362353377.tar.gz |
System Versioning 1.0 pre8
Merge branch '10.3' into trunk
Diffstat (limited to 'sql/partition_info.cc')
-rw-r--r-- | sql/partition_info.cc | 74 |
1 files changed, 21 insertions, 53 deletions
diff --git a/sql/partition_info.cc b/sql/partition_info.cc index 890385d0e87..8133f15012c 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -2989,6 +2989,25 @@ end: DBUG_RETURN(result); } + +bool partition_info::error_if_requires_values() const +{ + switch (part_type) { + case NOT_A_PARTITION: + case HASH_PARTITION: + case VERSIONING_PARTITION: + break; + case RANGE_PARTITION: + my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0), "RANGE", "LESS THAN"); + return true; + case LIST_PARTITION: + my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0), "LIST", "IN"); + return true; + } + return false; +} + + /** Fix partition data from parser. @@ -3079,6 +3098,8 @@ bool partition_info::fix_parser_data(THD *thd) part_elem= it++; List_iterator<part_elem_value> list_val_it(part_elem->list_val_list); num_elements= part_elem->list_val_list.elements; + if (!num_elements && error_if_requires_values()) + DBUG_RETURN(true); DBUG_ASSERT(part_type == RANGE_PARTITION ? num_elements == 1U : TRUE); @@ -3420,33 +3441,6 @@ bool partition_info::has_same_partitioning(partition_info *new_part_info) } -static bool has_same_column_order(List<Create_field> *create_list, - Field** field_array) -{ - Field **f_ptr; - List_iterator_fast<Create_field> new_field_it; - Create_field *new_field= NULL; - new_field_it.init(*create_list); - - for (f_ptr= field_array; *f_ptr; f_ptr++) - { - while ((new_field= new_field_it++)) - { - if (new_field->field == *f_ptr) - break; - } - if (!new_field) - break; - } - - if (!new_field) - { - /* Not same order!*/ - return false; - } - return true; -} - bool partition_info::vers_trx_id_to_ts(THD* thd, Field* in_trx_id, Field_timestamp& out_ts) { DBUG_ASSERT(table); @@ -3471,32 +3465,6 @@ bool partition_info::vers_trx_id_to_ts(THD* thd, Field* in_trx_id, Field_timesta } -/** - Check if the partitioning columns are in the same order as the given list. - - Used to see if INPLACE alter can be allowed or not. If the order is - different then the rows must be redistributed for KEY [sub]partitioning. - - @param[in] create_list Column list after ALTER TABLE. - @return true is same order as before ALTER TABLE, else false. -*/ -bool partition_info::same_key_column_order(List<Create_field> *create_list) -{ - /* Only need to check for KEY [sub] partitioning. */ - if (list_of_part_fields && !column_list) - { - if (!has_same_column_order(create_list, part_field_array)) - return false; - } - if (list_of_subpart_fields) - { - if (!has_same_column_order(create_list, subpart_field_array)) - return false; - } - return true; -} - - void partition_info::print_debug(const char *str, uint *value) { DBUG_ENTER("print_debug"); |