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
bb94b35f
Commit
bb94b35f
authored
Jun 11, 2006
by
igor@rurik.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge ibabaev@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into rurik.mysql.com:/home/igor/mysql-5.0-opt
parents
5ade9e75
c9bb9413
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
11 deletions
+56
-11
mysql-test/r/join.result
mysql-test/r/join.result
+20
-0
mysql-test/t/join.test
mysql-test/t/join.test
+25
-0
sql/sql_base.cc
sql/sql_base.cc
+11
-11
No files found.
mysql-test/r/join.result
View file @
bb94b35f
...
@@ -744,3 +744,23 @@ select a2 from ((t1 natural join t2) join t3 on b=c1) natural join t4;
...
@@ -744,3 +744,23 @@ select a2 from ((t1 natural join t2) join t3 on b=c1) natural join t4;
a2
a2
1
1
drop table t1,t2,t3,t4;
drop table t1,t2,t3,t4;
create table t1 (c int, b int);
create table t2 (a int, b int);
create table t3 (b int, c int);
create table t4 (y int, c int);
create table t5 (y int, z int);
insert into t1 values (3,2);
insert into t2 values (1,2);
insert into t3 values (2,3);
insert into t4 values (1,3);
insert into t5 values (1,4);
prepare stmt1 from "select * from ((t3 natural join (t1 natural join t2))
natural join t4) natural join t5";
execute stmt1;
y c b a z
1 3 2 1 4
select * from ((t3 natural join (t1 natural join t2)) natural join t4)
natural join t5;
y c b a z
1 3 2 1 4
drop table t1, t2, t3, t4, t5;
mysql-test/t/join.test
View file @
bb94b35f
...
@@ -563,4 +563,29 @@ select a2 from ((t1 natural join t2) join t3 on b=c1) natural join t4;
...
@@ -563,4 +563,29 @@ select a2 from ((t1 natural join t2) join t3 on b=c1) natural join t4;
drop
table
t1
,
t2
,
t3
,
t4
;
drop
table
t1
,
t2
,
t3
,
t4
;
#
# BUG#15355: Common natural join column not resolved in prepared statement nested query
#
create
table
t1
(
c
int
,
b
int
);
create
table
t2
(
a
int
,
b
int
);
create
table
t3
(
b
int
,
c
int
);
create
table
t4
(
y
int
,
c
int
);
create
table
t5
(
y
int
,
z
int
);
insert
into
t1
values
(
3
,
2
);
insert
into
t2
values
(
1
,
2
);
insert
into
t3
values
(
2
,
3
);
insert
into
t4
values
(
1
,
3
);
insert
into
t5
values
(
1
,
4
);
--
this
fails
prepare
stmt1
from
"select * from ((t3 natural join (t1 natural join t2))
natural join t4) natural join t5"
;
execute
stmt1
;
--
this
works
select
*
from
((
t3
natural
join
(
t1
natural
join
t2
))
natural
join
t4
)
natural
join
t5
;
drop
table
t1
,
t2
,
t3
,
t4
,
t5
;
# End of tests for WL#2486 - natural/using join
# End of tests for WL#2486 - natural/using join
sql/sql_base.cc
View file @
bb94b35f
...
@@ -4184,10 +4184,6 @@ static bool setup_natural_join_row_types(THD *thd,
...
@@ -4184,10 +4184,6 @@ static bool setup_natural_join_row_types(THD *thd,
if
(
from_clause
->
elements
==
0
)
if
(
from_clause
->
elements
==
0
)
return
FALSE
;
/* We come here in the case of UNIONs. */
return
FALSE
;
/* We come here in the case of UNIONs. */
/* For stored procedures do not redo work if already done. */
if
(
!
context
->
select_lex
->
first_execution
)
return
FALSE
;
List_iterator_fast
<
TABLE_LIST
>
table_ref_it
(
*
from_clause
);
List_iterator_fast
<
TABLE_LIST
>
table_ref_it
(
*
from_clause
);
TABLE_LIST
*
table_ref
;
/* Current table reference. */
TABLE_LIST
*
table_ref
;
/* Current table reference. */
/* Table reference to the left of the current. */
/* Table reference to the left of the current. */
...
@@ -4200,14 +4196,18 @@ static bool setup_natural_join_row_types(THD *thd,
...
@@ -4200,14 +4196,18 @@ static bool setup_natural_join_row_types(THD *thd,
{
{
table_ref
=
left_neighbor
;
table_ref
=
left_neighbor
;
left_neighbor
=
table_ref_it
++
;
left_neighbor
=
table_ref_it
++
;
if
(
store_top_level_join_columns
(
thd
,
table_ref
,
/* For stored procedures do not redo work if already done. */
left_neighbor
,
right_neighbor
))
if
(
context
->
select_lex
->
first_execution
)
return
TRUE
;
if
(
left_neighbor
)
{
{
TABLE_LIST
*
first_leaf_on_the_right
;
if
(
store_top_level_join_columns
(
thd
,
table_ref
,
first_leaf_on_the_right
=
table_ref
->
first_leaf_for_name_resolution
();
left_neighbor
,
right_neighbor
))
left_neighbor
->
next_name_resolution_table
=
first_leaf_on_the_right
;
return
TRUE
;
if
(
left_neighbor
)
{
TABLE_LIST
*
first_leaf_on_the_right
;
first_leaf_on_the_right
=
table_ref
->
first_leaf_for_name_resolution
();
left_neighbor
->
next_name_resolution_table
=
first_leaf_on_the_right
;
}
}
}
right_neighbor
=
table_ref
;
right_neighbor
=
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