summaryrefslogtreecommitdiff
path: root/sql/sql_lex.h
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2019-09-20 09:03:38 -0700
committerIgor Babaev <igor@askmonty.org>2019-09-23 09:57:37 -0700
commitb44171428ab2ea25db82f7cd27349e67812e4921 (patch)
tree15508ccee1f052305f1fe8b421e9dbf69f8df6e8 /sql/sql_lex.h
parente3da362c037af95a85d3054243a4c9a039ceb4b4 (diff)
downloadmariadb-git-b44171428ab2ea25db82f7cd27349e67812e4921.tar.gz
MDEV-19956 Queries with subqueries containing UNION are not parsed
Shift-Reduce conflicts prevented parsing some queries with subqueries that used set operations when the subqueries occurred in expressions or in IN predicands. The grammar rules for query expression were transformed in order to avoid these conflicts. New grammar rules employ an idea taken from MySQL 8.0.
Diffstat (limited to 'sql/sql_lex.h')
-rw-r--r--sql/sql_lex.h48
1 files changed, 27 insertions, 21 deletions
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 8296f9e2dec..8d09407606a 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -4414,9 +4414,6 @@ public:
insert_list= 0;
}
- bool make_select_in_brackets(SELECT_LEX* dummy_select,
- SELECT_LEX *nselect, bool automatic);
-
SELECT_LEX_UNIT *alloc_unit();
SELECT_LEX *alloc_select(bool is_select);
SELECT_LEX_UNIT *create_unit(SELECT_LEX*);
@@ -4426,7 +4423,7 @@ public:
bool insert_select_hack(SELECT_LEX *sel);
SELECT_LEX *create_priority_nest(SELECT_LEX *first_in_nest);
- void set_main_unit(st_select_lex_unit *u)
+ bool set_main_unit(st_select_lex_unit *u)
{
unit.options= u->options;
unit.uncacheable= u->uncacheable;
@@ -4436,16 +4433,10 @@ public:
unit.union_distinct= u->union_distinct;
unit.set_with_clause(u->with_clause);
builtin_select.exclude_from_global();
+ return false;
}
bool check_main_unit_semantics();
- // reaction on different parsed parts (bodies are in sql_yacc.yy)
- bool parsed_unit_in_brackets(SELECT_LEX_UNIT *unit);
- SELECT_LEX *parsed_select(SELECT_LEX *sel, Lex_order_limit_lock * l);
- SELECT_LEX *parsed_unit_in_brackets_tail(SELECT_LEX_UNIT *unit,
- Lex_order_limit_lock * l);
- SELECT_LEX *parsed_select_in_brackets(SELECT_LEX *sel,
- Lex_order_limit_lock * l);
SELECT_LEX_UNIT *parsed_select_expr_start(SELECT_LEX *s1, SELECT_LEX *s2,
enum sub_select_type unit_type,
bool distinct);
@@ -4453,20 +4444,35 @@ public:
SELECT_LEX *s2,
enum sub_select_type unit_type,
bool distinct, bool oracle);
- SELECT_LEX_UNIT *parsed_body_select(SELECT_LEX *sel,
- Lex_order_limit_lock * l);
- bool parsed_body_unit(SELECT_LEX_UNIT *unit);
- SELECT_LEX_UNIT *parsed_body_unit_tail(SELECT_LEX_UNIT *unit,
- Lex_order_limit_lock * l);
+ bool parsed_multi_operand_query_expression_body(SELECT_LEX_UNIT *unit);
+ SELECT_LEX_UNIT *add_tail_to_query_expression_body(SELECT_LEX_UNIT *unit,
+ Lex_order_limit_lock *l);
+ SELECT_LEX_UNIT *
+ add_tail_to_query_expression_body_ext_parens(SELECT_LEX_UNIT *unit,
+ Lex_order_limit_lock *l);
+ SELECT_LEX_UNIT *parsed_body_ext_parens_primary(SELECT_LEX_UNIT *unit,
+ SELECT_LEX *primary,
+ enum sub_select_type unit_type,
+ bool distinct);
+ SELECT_LEX_UNIT *
+ add_primary_to_query_expression_body(SELECT_LEX_UNIT *unit,
+ SELECT_LEX *sel,
+ enum sub_select_type unit_type,
+ bool distinct,
+ bool oracle);
+ SELECT_LEX_UNIT *
+ add_primary_to_query_expression_body_ext_parens(
+ SELECT_LEX_UNIT *unit,
+ SELECT_LEX *sel,
+ enum sub_select_type unit_type,
+ bool distinct);
SELECT_LEX *parsed_subselect(SELECT_LEX_UNIT *unit);
bool parsed_insert_select(SELECT_LEX *firs_select);
bool parsed_TVC_start();
SELECT_LEX *parsed_TVC_end();
- TABLE_LIST *parsed_derived_select(SELECT_LEX *sel, int for_system_time,
- LEX_CSTRING *alias);
- TABLE_LIST *parsed_derived_unit(SELECT_LEX_UNIT *unit,
- int for_system_time,
- LEX_CSTRING *alias);
+ TABLE_LIST *parsed_derived_table(SELECT_LEX_UNIT *unit,
+ int for_system_time,
+ LEX_CSTRING *alias);
bool parsed_create_view(SELECT_LEX_UNIT *unit, int check);
bool select_finalize(st_select_lex_unit *expr);
bool select_finalize(st_select_lex_unit *expr, Lex_select_lock l);