Commit 8bd61c3f authored by pem@mysql.com's avatar pem@mysql.com
Browse files

Task 430: Allowing braces in joins by simply removing them.

This is a simple fix, allowing a join_table_list in the right reduction of a
normal_join sequence, instead of just a join_table. This makes things like
"t1, (t2 left join t3)" work, but it also allows "join" and "cross join" instead
of ",".

This should fix the bug reported as:
  Subject: ODBC SQL syntax issue 
  From: Ivan Vazharov 
  Date: Mon, 30 Sep 2002 12:02:42 +0200 
parent 3805a5ed
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -85,3 +85,4 @@ zgreant@mysql.com
tfr@beta.frontier86.ee
Administrador@light.
mwagner@work.mysql.com
pem@mysql.com
+27 −0
Original line number Diff line number Diff line
@@ -3266,3 +3266,30 @@ select wss_type from t1 where wss_type =102935229216544093;
wss_type
102935229216544093
drop table t1;
create table t1 (a int not null auto_increment primary key);
insert into t1 values ();
insert into t1 values ();
insert into t1 values ();
select * from (t1 as t2 left join t1 as t3 using (a)), t1;
a	a	a
1	1	1
2	2	1
3	3	1
1	1	2
2	2	2
3	3	2
1	1	3
2	2	3
3	3	3
select * from t1, (t1 as t2 left join t1 as t3 using (a));
a	a	a
1	1	1
2	1	1
3	1	1
1	2	2
2	2	2
3	2	2
1	3	3
2	3	3
3	3	3
drop table t1;
+13 −0
Original line number Diff line number Diff line
@@ -1751,3 +1751,16 @@ select wss_type from t1 where wss_type ='102935229216544104';
select wss_type from t1 where wss_type ='102935229216544093';
select wss_type from t1 where wss_type =102935229216544093;
drop table t1;

#
# Test of removing redundant braces in the FROM part
# (The second case used to cause a syntax error)
#

create table t1 (a int not null auto_increment primary key);
insert into t1 values ();
insert into t1 values ();
insert into t1 values ();
select * from (t1 as t2 left join t1 as t3 using (a)), t1;
select * from t1, (t1 as t2 left join t1 as t3 using (a));
drop table t1;
+4 −1
Original line number Diff line number Diff line
@@ -2026,7 +2026,7 @@ opt_pad:
join_table_list:
	'(' join_table_list ')'	{ $$=$2; }
	| join_table		{ $$=$1; }
	| join_table_list normal_join join_table { $$=$3; }
	| join_table_list normal_join join_table_list { $$=$3; }
	| join_table_list STRAIGHT_JOIN join_table { $$=$3 ; $$->straight=1; }
	| join_table_list INNER_SYM JOIN_SYM join_table ON expr
	  { add_join_on($4,$6); $$=$4; }
@@ -3307,6 +3307,7 @@ option_value:
	  {
	    Lex->var_list.push_back(new set_var_password($3,$5));
	  }
	;

internal_variable_name:
	ident
@@ -3316,6 +3317,7 @@ internal_variable_name:
	    YYABORT;
	  $$=tmp;
	}
	;

isolation_types:
	READ_SYM UNCOMMITTED_SYM	{ $$= ISO_READ_UNCOMMITTED; }
@@ -3674,6 +3676,7 @@ require_clause: /* empty */
	  {
	    Lex->ssl_type=SSL_TYPE_NONE;
	  }
	;

grant_options:
	/* empty */ {}