Commit d2013e73 authored by Igor Babaev's avatar Igor Babaev

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.
parent ae15f91f
......@@ -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;
......@@ -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;
......@@ -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;
......
......@@ -1165,6 +1165,7 @@ class st_select_lex: public st_select_lex_node
*/
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 */
......
......@@ -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 {}
......
......@@ -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 {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment