diff options
author | Sreeharsha Ramanavarapu <sreeharsha.ramanavarapu@oracle.com> | 2018-08-19 10:00:30 +0530 |
---|---|---|
committer | Sreeharsha Ramanavarapu <sreeharsha.ramanavarapu@oracle.com> | 2018-08-19 10:00:30 +0530 |
commit | a653fca99be15b6c3bd6483041578f0bfe5bf5b0 (patch) | |
tree | 0504303c3705948d55e03f56ee7bed888972b64a | |
parent | fe5df42a3753dd5b183395c304ae80891da0dda7 (diff) | |
download | mariadb-git-a653fca99be15b6c3bd6483041578f0bfe5bf5b0.tar.gz |
Bug #26791931: INCORRECT BEHAVIOR IN ALTER TABLE REORGANIZE
PARTITION
Issue:
------
ALTER TABLE REORGANIZE PARTITION .... can result in
incorrect behavior if any partition other than the last
one misses the "VALUES LESS THAN..." part of the syntax.
Root cause:
-----------
Currently ALTER TABLE with changes to partitions is handled
incorrectly by the parser.
Fix:
----
The if condition which handles partition management
differently for ALTER TABLE in the parser should be removed.
Change the code to handle the case in the parser.
-rw-r--r-- | sql/sql_yacc.yy | 59 |
1 files changed, 25 insertions, 34 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 2ca36e23652..328fb138196 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -4670,56 +4670,47 @@ opt_part_values: { LEX *lex= Lex; partition_info *part_info= lex->part_info; - if (! lex->is_partition_management()) + if (part_info->part_type == NOT_A_PARTITION) + part_info->part_type= HASH_PARTITION; + else if (part_info->part_type == RANGE_PARTITION) { - if (part_info->part_type == RANGE_PARTITION) - { - my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0), - "RANGE", "LESS THAN"); - MYSQL_YYABORT; - } - if (part_info->part_type == LIST_PARTITION) - { - my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0), - "LIST", "IN"); - MYSQL_YYABORT; - } + my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0), + "RANGE", "LESS THAN"); + MYSQL_YYABORT; + } + else if (part_info->part_type == LIST_PARTITION) + { + my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0), + "LIST", "IN"); + MYSQL_YYABORT; } - else - part_info->part_type= HASH_PARTITION; } | VALUES LESS_SYM THAN_SYM { LEX *lex= Lex; partition_info *part_info= lex->part_info; - if (! lex->is_partition_management()) + if (part_info->part_type == NOT_A_PARTITION) + part_info->part_type= RANGE_PARTITION; + else if (part_info->part_type != RANGE_PARTITION) { - if (part_info->part_type != RANGE_PARTITION) - { - my_error(ER_PARTITION_WRONG_VALUES_ERROR, MYF(0), - "RANGE", "LESS THAN"); - MYSQL_YYABORT; - } + my_error(ER_PARTITION_WRONG_VALUES_ERROR, MYF(0), + "RANGE", "LESS THAN"); + MYSQL_YYABORT; } - else - part_info->part_type= RANGE_PARTITION; } part_func_max {} | VALUES IN_SYM { LEX *lex= Lex; partition_info *part_info= lex->part_info; - if (! lex->is_partition_management()) + if (part_info->part_type == NOT_A_PARTITION) + part_info->part_type= LIST_PARTITION; + else if (part_info->part_type != LIST_PARTITION) { - if (part_info->part_type != LIST_PARTITION) - { - my_error(ER_PARTITION_WRONG_VALUES_ERROR, MYF(0), - "LIST", "IN"); - MYSQL_YYABORT; - } + my_error(ER_PARTITION_WRONG_VALUES_ERROR, MYF(0), + "LIST", "IN"); + MYSQL_YYABORT; } - else - part_info->part_type= LIST_PARTITION; } part_values_in {} ; |