Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
d24027fa
Commit
d24027fa
authored
Oct 25, 2005
by
timour@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/timka/mysql/src/5.0-virgin
into mysql.com:/home/timka/mysql/src/5.0-bug-13832
parents
192bceaf
f5354eba
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
9 deletions
+49
-9
mysql-test/r/select.result
mysql-test/r/select.result
+12
-0
mysql-test/t/select.test
mysql-test/t/select.test
+14
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+23
-9
No files found.
mysql-test/r/select.result
View file @
d24027fa
...
@@ -3181,3 +3181,15 @@ from t1 inner join (t2 right join t3 on t2.id = t3.b_id) on t1.id = t3.a_id;
...
@@ -3181,3 +3181,15 @@ from t1 inner join (t2 right join t3 on t2.id = t3.b_id) on t1.id = t3.a_id;
count(*)
count(*)
6
6
drop table t1,t2,t3;
drop table t1,t2,t3;
create table t1 (a int);
create table t2 (b int);
create table t3 (c int);
select * from t1 join t2 join t3 on (t1.a=t3.c);
a b c
select * from t1 join t2 left join t3 on (t1.a=t3.c);
a b c
select * from t1 join t2 right join t3 on (t1.a=t3.c);
a b c
select * from t1 join t2 straight_join t3 on (t1.a=t3.c);
a b c
drop table t1, t2 ,t3;
mysql-test/t/select.test
View file @
d24027fa
...
@@ -2688,3 +2688,17 @@ select count(*)
...
@@ -2688,3 +2688,17 @@ select count(*)
from
t1
inner
join
(
t2
right
join
t3
on
t2
.
id
=
t3
.
b_id
)
on
t1
.
id
=
t3
.
a_id
;
from
t1
inner
join
(
t2
right
join
t3
on
t2
.
id
=
t3
.
b_id
)
on
t1
.
id
=
t3
.
a_id
;
drop
table
t1
,
t2
,
t3
;
drop
table
t1
,
t2
,
t3
;
#
# Bug #13832 Incorrect parse order of join productions due to unspecified
# operator priorities results in incorrect join tree.
#
create
table
t1
(
a
int
);
create
table
t2
(
b
int
);
create
table
t3
(
c
int
);
select
*
from
t1
join
t2
join
t3
on
(
t1
.
a
=
t3
.
c
);
select
*
from
t1
join
t2
left
join
t3
on
(
t1
.
a
=
t3
.
c
);
select
*
from
t1
join
t2
right
join
t3
on
(
t1
.
a
=
t3
.
c
);
select
*
from
t1
join
t2
straight_join
t3
on
(
t1
.
a
=
t3
.
c
);
drop
table
t1
,
t2
,
t3
;
sql/sql_yacc.yy
View file @
d24027fa
...
@@ -660,7 +660,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
...
@@ -660,7 +660,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token YEAR_SYM
%token YEAR_SYM
%token ZEROFILL
%token ZEROFILL
%left JOIN_SYM
%left JOIN_SYM
INNER_SYM STRAIGHT_JOIN CROSS LEFT RIGHT
/* A dummy token to force the priority of table_ref production in a join. */
/* A dummy token to force the priority of table_ref production in a join. */
%left TABLE_REF_PRIORITY
%left TABLE_REF_PRIORITY
%left SET_VAR
%left SET_VAR
...
@@ -5227,14 +5227,22 @@ derived_table_list:
...
@@ -5227,14 +5227,22 @@ derived_table_list:
}
}
;
;
/*
Notice that JOIN is a left-associative operation, and it must be parsed
as such, that is, the parser must process first the left join operand
then the right one. Such order of processing ensures that the parser
produces correct join trees which is essential for semantic analysis
and subsequent optimization phases.
*/
join_table:
join_table:
/* INNER JOIN variants */
/*
/*
Evaluate production 'table_ref' before 'normal_join' so that
Use %prec to evaluate production 'table_ref' before 'normal_join'
[INNER | CROSS] JOIN is properly nested as other left-associative
so that [INNER | CROSS] JOIN is properly nested as other
joins.
left-associative
joins.
*/
*/
table_ref %prec TABLE_REF_PRIORITY normal_join table_ref
table_ref %prec TABLE_REF_PRIORITY normal_join table_ref
{ YYERROR_UNLESS($1 && ($$=$3)); }
{ YYERROR_UNLESS($1 && ($$=$3)); }
| table_ref STRAIGHT_JOIN table_factor
| table_ref STRAIGHT_JOIN table_factor
{ YYERROR_UNLESS($1 && ($$=$3)); $3->straight=1; }
{ YYERROR_UNLESS($1 && ($$=$3)); $3->straight=1; }
| table_ref normal_join table_ref
| table_ref normal_join table_ref
...
@@ -5276,6 +5284,13 @@ join_table:
...
@@ -5276,6 +5284,13 @@ join_table:
}
}
'(' using_list ')'
'(' using_list ')'
{ add_join_natural($1,$3,$7); $$=$3; }
{ add_join_natural($1,$3,$7); $$=$3; }
| table_ref NATURAL JOIN_SYM table_factor
{
YYERROR_UNLESS($1 && ($$=$4));
add_join_natural($1,$4,NULL);
}
/* LEFT JOIN variants */
| table_ref LEFT opt_outer JOIN_SYM table_ref
| table_ref LEFT opt_outer JOIN_SYM table_ref
ON
ON
{
{
...
@@ -5307,6 +5322,8 @@ join_table:
...
@@ -5307,6 +5322,8 @@ join_table:
$6->outer_join|=JOIN_TYPE_LEFT;
$6->outer_join|=JOIN_TYPE_LEFT;
$$=$6;
$$=$6;
}
}
/* RIGHT JOIN variants */
| table_ref RIGHT opt_outer JOIN_SYM table_ref
| table_ref RIGHT opt_outer JOIN_SYM table_ref
ON
ON
{
{
...
@@ -5344,10 +5361,7 @@ join_table:
...
@@ -5344,10 +5361,7 @@ join_table:
LEX *lex= Lex;
LEX *lex= Lex;
if (!($$= lex->current_select->convert_right_join()))
if (!($$= lex->current_select->convert_right_join()))
YYABORT;
YYABORT;
}
};
| table_ref NATURAL JOIN_SYM table_factor
{ YYERROR_UNLESS($1 && ($$=$4)); add_join_natural($1,$4,NULL); };
normal_join:
normal_join:
JOIN_SYM {}
JOIN_SYM {}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment