Commit 7e66a24d authored by Alexander Barkov's avatar Alexander Barkov

MDEV-10079 sql_yacc.yy: Remove non-parenthesized SELECT from table_ref

parent 971d777a
......@@ -3404,7 +3404,7 @@ f1 f2 f2
NULL a NULL
drop table t1,t2;
select * from (select * left join t on f1=f2) tt;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'on f1=f2) tt' at line 1
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'left join t on f1=f2) tt' at line 1
CREATE TABLE t1 (sku int PRIMARY KEY, pr int);
CREATE TABLE t2 (sku int PRIMARY KEY, sppr int, name varchar(255));
INSERT INTO t1 VALUES
......
......@@ -3415,7 +3415,7 @@ f1 f2 f2
NULL a NULL
drop table t1,t2;
select * from (select * left join t on f1=f2) tt;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'on f1=f2) tt' at line 1
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'left join t on f1=f2) tt' at line 1
CREATE TABLE t1 (sku int PRIMARY KEY, pr int);
CREATE TABLE t2 (sku int PRIMARY KEY, sppr int, name varchar(255));
INSERT INTO t1 VALUES
......
......@@ -3404,7 +3404,7 @@ f1 f2 f2
NULL a NULL
drop table t1,t2;
select * from (select * left join t on f1=f2) tt;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'on f1=f2) tt' at line 1
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'left join t on f1=f2) tt' at line 1
CREATE TABLE t1 (sku int PRIMARY KEY, pr int);
CREATE TABLE t2 (sku int PRIMARY KEY, sppr int, name varchar(255));
INSERT INTO t1 VALUES
......
......@@ -1037,10 +1037,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%parse-param { THD *thd }
%lex-param { THD *thd }
/*
Currently there are 123 shift/reduce conflicts.
Currently there are 104 shift/reduce conflicts.
We should not introduce new conflicts any more.
*/
%expect 123
%expect 104
/*
Comments for TOKENS.
......@@ -1878,7 +1878,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%type <table_list>
join_table_list join_table
table_factor table_ref_select table_ref esc_table_ref
table_factor table_ref esc_table_ref
table_primary_ident table_primary_derived
select_derived derived_table_list
select_derived_union
......@@ -10768,7 +10768,6 @@ when_list:
/* Warning - may return NULL in case of incomplete SELECT */
table_ref:
table_factor { $$= $1; }
| table_ref_select { $$= $1; }
| join_table
{
LEX *lex= Lex;
......@@ -11006,9 +11005,6 @@ table_ref_select:
}
if ($2->init_nested_join(lex->thd))
MYSQL_YYABORT;
$$= 0;
/* incomplete derived tables return NULL, we must be
nested in select_derived rule to be here. */
}
;
......@@ -11202,6 +11198,12 @@ select_derived:
MYSQL_YYABORT;
}
}
| get_select_lex_derived table_ref_select
{
LEX *lex= Lex;
$$= $1->end_nested_join(lex->thd);
DBUG_ASSERT($$ == NULL);
}
;
select_derived2:
......
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