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

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
...@@ -85,3 +85,4 @@ zgreant@mysql.com ...@@ -85,3 +85,4 @@ zgreant@mysql.com
tfr@beta.frontier86.ee tfr@beta.frontier86.ee
Administrador@light. Administrador@light.
mwagner@work.mysql.com mwagner@work.mysql.com
pem@mysql.com
...@@ -3266,3 +3266,30 @@ select wss_type from t1 where wss_type =102935229216544093; ...@@ -3266,3 +3266,30 @@ select wss_type from t1 where wss_type =102935229216544093;
wss_type wss_type
102935229216544093 102935229216544093
drop table t1; 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;
...@@ -1751,3 +1751,16 @@ select wss_type from t1 where wss_type ='102935229216544104'; ...@@ -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';
select wss_type from t1 where wss_type =102935229216544093; select wss_type from t1 where wss_type =102935229216544093;
drop table t1; 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;
...@@ -2026,7 +2026,7 @@ opt_pad: ...@@ -2026,7 +2026,7 @@ opt_pad:
join_table_list: join_table_list:
'(' join_table_list ')' { $$=$2; } '(' join_table_list ')' { $$=$2; }
| join_table { $$=$1; } | 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 STRAIGHT_JOIN join_table { $$=$3 ; $$->straight=1; }
| join_table_list INNER_SYM JOIN_SYM join_table ON expr | join_table_list INNER_SYM JOIN_SYM join_table ON expr
{ add_join_on($4,$6); $$=$4; } { add_join_on($4,$6); $$=$4; }
...@@ -3307,6 +3307,7 @@ option_value: ...@@ -3307,6 +3307,7 @@ option_value:
{ {
Lex->var_list.push_back(new set_var_password($3,$5)); Lex->var_list.push_back(new set_var_password($3,$5));
} }
;
internal_variable_name: internal_variable_name:
ident ident
...@@ -3316,6 +3317,7 @@ internal_variable_name: ...@@ -3316,6 +3317,7 @@ internal_variable_name:
YYABORT; YYABORT;
$$=tmp; $$=tmp;
} }
;
isolation_types: isolation_types:
READ_SYM UNCOMMITTED_SYM { $$= ISO_READ_UNCOMMITTED; } READ_SYM UNCOMMITTED_SYM { $$= ISO_READ_UNCOMMITTED; }
...@@ -3674,6 +3676,7 @@ require_clause: /* empty */ ...@@ -3674,6 +3676,7 @@ require_clause: /* empty */
{ {
Lex->ssl_type=SSL_TYPE_NONE; Lex->ssl_type=SSL_TYPE_NONE;
} }
;
grant_options: grant_options:
/* empty */ {} /* empty */ {}
......
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