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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
54db60c0
Commit
54db60c0
authored
Sep 12, 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-12943
parents
2315c4f2
7d24bdac
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
2 deletions
+52
-2
mysql-test/r/select.result
mysql-test/r/select.result
+20
-0
mysql-test/t/select.test
mysql-test/t/select.test
+21
-0
sql/sql_parse.cc
sql/sql_parse.cc
+1
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+10
-1
No files found.
mysql-test/r/select.result
View file @
54db60c0
...
...
@@ -2922,3 +2922,23 @@ a b b
select * from t1 inner join t2 using (a);
a b b
1 10 10
create table t1 (a int, c int);
create table t2 (b int);
create table t3 (b int, a int);
create table t4 (c int);
insert into t1 values (1,1);
insert into t2 values (1);
insert into t3 values (1,1);
insert into t4 values (1);
select * from t1 join t2 join t3 on (t2.b = t3.b and t1.a = t3.a);
a c b b a
1 1 1 1 1
select * from t1, t2 join t3 on (t2.b = t3.b and t1.a = t3.a);
ERROR 42S22: Unknown column 't1.a' in 'on clause'
select * from t1 join t2 join t3 join t4 on (t1.a = t4.c and t2.b = t4.c);
a c b b a c
1 1 1 1 1 1
select * from t1 join t2 join t4 using (c);
c a b
1 1 1
drop table t1, t2, t3, t4;
mysql-test/t/select.test
View file @
54db60c0
...
...
@@ -2499,3 +2499,24 @@ insert into t2 values (1,10);
# both queries should produce the same result
select
*
from
t1
inner
join
t2
using
(
A
);
select
*
from
t1
inner
join
t2
using
(
a
);
# Bug #12943 Incorrect nesting of [INNER| CROSS] JOIN due to unspecified
# associativity in the parser.
#
create
table
t1
(
a
int
,
c
int
);
create
table
t2
(
b
int
);
create
table
t3
(
b
int
,
a
int
);
create
table
t4
(
c
int
);
insert
into
t1
values
(
1
,
1
);
insert
into
t2
values
(
1
);
insert
into
t3
values
(
1
,
1
);
insert
into
t4
values
(
1
);
select
*
from
t1
join
t2
join
t3
on
(
t2
.
b
=
t3
.
b
and
t1
.
a
=
t3
.
a
);
# Notice that ',' has lower priority than 'join', thus we have that:
# t1, t2 join t3 <==> t1, (t2 join t3).
--
error
1054
select
*
from
t1
,
t2
join
t3
on
(
t2
.
b
=
t3
.
b
and
t1
.
a
=
t3
.
a
);
select
*
from
t1
join
t2
join
t3
join
t4
on
(
t1
.
a
=
t4
.
c
and
t2
.
b
=
t4
.
c
);
select
*
from
t1
join
t2
join
t4
using
(
c
);
drop
table
t1
,
t2
,
t3
,
t4
;
sql/sql_parse.cc
View file @
54db60c0
...
...
@@ -6360,7 +6360,7 @@ void st_select_lex::set_lock_for_tables(thr_lock_type lock_type)
SYNOPSIS
make_join_on_context()
thd pointer to current thread
left_op left
o
operand of the JOIN
left_op left
operand of the JOIN
right_op rigth operand of the JOIN
DESCRIPTION
...
...
sql/sql_yacc.yy
View file @
54db60c0
...
...
@@ -660,6 +660,9 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token YEAR_SYM
%token ZEROFILL
%left JOIN_SYM
/* A dummy token to force the priority of table_ref production in a join. */
%left TABLE_REF_PRIORITY
%left SET_VAR
%left OR_OR_SYM OR_SYM OR2_SYM XOR
%left AND_SYM AND_AND_SYM
...
...
@@ -5189,7 +5192,13 @@ derived_table_list:
;
join_table:
table_ref normal_join table_ref { YYERROR_UNLESS($1 && ($$=$3)); }
/*
Evaluate production 'table_ref' before 'normal_join' so that
[INNER | CROSS] JOIN is properly nested as other left-associative
joins.
*/
table_ref %prec TABLE_REF_PRIORITY normal_join table_ref
{ YYERROR_UNLESS($1 && ($$=$3)); }
| table_ref STRAIGHT_JOIN table_factor
{ YYERROR_UNLESS($1 && ($$=$3)); $3->straight=1; }
| table_ref normal_join table_ref
...
...
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