1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

MDEV-18982 Partition pruning with column list causes syntax error in 10.4

A syntax error was reported for any INSERT statement with explicit
partition selection it if i used a column list.
Fixed by saving the parsing place before parsing the clause for explicit
partition selection and restoring it when the clause has been parsed.
This commit is contained in:
Igor Babaev
2019-04-04 16:36:26 -07:00
parent ae15f91f22
commit d2013e7328
6 changed files with 34 additions and 2 deletions

View File

@@ -1897,3 +1897,12 @@ SELECT * FROM t1 PARTITION (p0);
i
UNLOCK TABLES;
DROP TABLE t1, t2;
#
# MDEV-18982: INSERT using explicit patition pruning with column list
#
create table t1 (a int) partition by hash(a);
insert into t1 partition (p0) (a) values (1);
select * from t1;
a
1
drop table t1;

View File

@@ -877,3 +877,12 @@ UNLOCK TABLES;
# Cleanup
DROP TABLE t1, t2;
--echo #
--echo # MDEV-18982: INSERT using explicit patition pruning with column list
--echo #
create table t1 (a int) partition by hash(a);
insert into t1 partition (p0) (a) values (1);
select * from t1;
drop table t1;

View File

@@ -2381,6 +2381,7 @@ void st_select_lex::init_query()
first_natural_join_processing= 1;
first_cond_optimization= 1;
parsing_place= NO_MATTER;
save_parsing_place= NO_MATTER;
exclude_from_table_unique_test= no_wrap_view_item= FALSE;
nest_level= 0;
link_next= 0;

View File

@@ -1165,6 +1165,7 @@ public:
*/
uint hidden_bit_fields;
enum_parsing_place parsing_place; /* where we are parsing expression */
enum_parsing_place save_parsing_place;
enum_parsing_place context_analysis_place; /* where we are in prepare */
bool with_sum_func; /* sum function indicator */

View File

@@ -12052,6 +12052,8 @@ use_partition:
PARTITION_SYM '(' using_list ')' have_partitioning
{
$$= $3;
Select->parsing_place= Select->save_parsing_place;
Select->save_parsing_place= NO_MATTER;
}
;
@@ -13347,13 +13349,17 @@ insert2:
;
insert_table:
{
Select->save_parsing_place= Select->parsing_place;
}
table_name_with_opt_use_partition
{
LEX *lex=Lex;
//lex->field_list.empty();
lex->many_values.empty();
lex->insert_list=0;
};
}
;
insert_field_spec:
insert_values {}

View File

@@ -12174,6 +12174,8 @@ use_partition:
PARTITION_SYM '(' using_list ')' have_partitioning
{
$$= $3;
Select->parsing_place= Select->save_parsing_place;
Select->save_parsing_place= NO_MATTER;
}
;
@@ -13485,13 +13487,17 @@ insert2:
;
insert_table:
{
Select->save_parsing_place= Select->parsing_place;
}
table_name_with_opt_use_partition
{
LEX *lex=Lex;
//lex->field_list.empty();
lex->many_values.empty();
lex->insert_list=0;
};
}
;
insert_field_spec:
insert_values {}