From 7e66a24dfb381290d59786c36e1dc478ad365bd1 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Tue, 17 May 2016 13:41:39 +0400 Subject: [PATCH] MDEV-10079 sql_yacc.yy: Remove non-parenthesized SELECT from table_ref --- mysql-test/r/select.result | 2 +- mysql-test/r/select_jcl6.result | 2 +- mysql-test/r/select_pkeycache.result | 2 +- sql/sql_yacc.yy | 16 +++++++++------- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 9dbf6e0c46b..8e516c93a14 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -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 diff --git a/mysql-test/r/select_jcl6.result b/mysql-test/r/select_jcl6.result index 81e52929881..99400a09ac7 100644 --- a/mysql-test/r/select_jcl6.result +++ b/mysql-test/r/select_jcl6.result @@ -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 diff --git a/mysql-test/r/select_pkeycache.result b/mysql-test/r/select_pkeycache.result index 9dbf6e0c46b..8e516c93a14 100644 --- a/mysql-test/r/select_pkeycache.result +++ b/mysql-test/r/select_pkeycache.result @@ -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 diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 688b1448b04..2552c93c520 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -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 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: