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
920e4565
Commit
920e4565
authored
Sep 29, 2005
by
ramil@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix for bug #13545: Server crash caused by select query.
parent
0e75a93a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
9 deletions
+65
-9
mysql-test/r/join_nested.result
mysql-test/r/join_nested.result
+28
-0
mysql-test/t/join_nested.test
mysql-test/t/join_nested.test
+31
-0
sql/sql_base.cc
sql/sql_base.cc
+6
-9
No files found.
mysql-test/r/join_nested.result
View file @
920e4565
...
...
@@ -1375,3 +1375,31 @@ groupid price
6 9900
DROP VIEW v1,v2;
DROP TABLE t1,t2,t3,t4;
CREATE TABLE t1(a int);
CREATE TABLE t2(b int);
CREATE TABLE t3(c int, d int);
CREATE TABLE t4(d int);
CREATE TABLE t5(e int, f int);
CREATE TABLE t6(f int);
CREATE VIEW v1 AS
SELECT e FROM t5 JOIN t6 ON t5.e=t6.f;
CREATE VIEW v2 AS
SELECT e FROM t5 NATURAL JOIN t6;
SELECT t1.a FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c JOIN t4 USING(d);
a
SELECT t1.x FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c JOIN t4 USING(d);
ERROR 42S22: Unknown column 't1.x' in 'field list'
SELECT t1.a FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c NATURAL JOIN t4;
a
SELECT t1.x FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c NATURAL JOIN t4;
ERROR 42S22: Unknown column 't1.x' in 'field list'
SELECT v1.e FROM v1 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
e
SELECT v1.x FROM v1 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
ERROR 42S22: Unknown column 'v1.x' in 'field list'
SELECT v2.e FROM v2 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
e
SELECT v2.x FROM v2 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
ERROR 42S22: Unknown column 'v2.x' in 'field list'
DROP VIEW v1, v2;
DROP TABLE t1, t2, t3, t4, t5, t6;
mysql-test/t/join_nested.test
View file @
920e4565
...
...
@@ -801,3 +801,34 @@ SELECT * FROM
DROP
VIEW
v1
,
v2
;
DROP
TABLE
t1
,
t2
,
t3
,
t4
;
#
# Bug #13545: problem with NATURAL/USING joins.
#
CREATE
TABLE
t1
(
a
int
);
CREATE
TABLE
t2
(
b
int
);
CREATE
TABLE
t3
(
c
int
,
d
int
);
CREATE
TABLE
t4
(
d
int
);
CREATE
TABLE
t5
(
e
int
,
f
int
);
CREATE
TABLE
t6
(
f
int
);
CREATE
VIEW
v1
AS
SELECT
e
FROM
t5
JOIN
t6
ON
t5
.
e
=
t6
.
f
;
CREATE
VIEW
v2
AS
SELECT
e
FROM
t5
NATURAL
JOIN
t6
;
SELECT
t1
.
a
FROM
t1
JOIN
t2
ON
a
=
b
JOIN
t3
ON
a
=
c
JOIN
t4
USING
(
d
);
--
error
1054
SELECT
t1
.
x
FROM
t1
JOIN
t2
ON
a
=
b
JOIN
t3
ON
a
=
c
JOIN
t4
USING
(
d
);
SELECT
t1
.
a
FROM
t1
JOIN
t2
ON
a
=
b
JOIN
t3
ON
a
=
c
NATURAL
JOIN
t4
;
--
error
1054
SELECT
t1
.
x
FROM
t1
JOIN
t2
ON
a
=
b
JOIN
t3
ON
a
=
c
NATURAL
JOIN
t4
;
SELECT
v1
.
e
FROM
v1
JOIN
t2
ON
e
=
b
JOIN
t3
ON
e
=
c
JOIN
t4
USING
(
d
);
--
error
1054
SELECT
v1
.
x
FROM
v1
JOIN
t2
ON
e
=
b
JOIN
t3
ON
e
=
c
JOIN
t4
USING
(
d
);
SELECT
v2
.
e
FROM
v2
JOIN
t2
ON
e
=
b
JOIN
t3
ON
e
=
c
JOIN
t4
USING
(
d
);
--
error
1054
SELECT
v2
.
x
FROM
v2
JOIN
t2
ON
e
=
b
JOIN
t3
ON
e
=
c
JOIN
t4
USING
(
d
);
DROP
VIEW
v1
,
v2
;
DROP
TABLE
t1
,
t2
,
t3
,
t4
,
t5
,
t6
;
sql/sql_base.cc
View file @
920e4565
...
...
@@ -2988,7 +2988,7 @@ find_field_in_table_ref(THD *thd, TABLE_LIST *table_list,
are the same as the table reference we are going to search for the field.
We exclude from the test below NATURAL/USING joins and any nested join
that is an operand of NATURAL/USING join,
because each column in such
because each column in such
joins may potentially originate from a different table. However, base
tables and views that are under some NATURAL/USING join are searched
as usual base tables/views.
...
...
@@ -3001,8 +3001,8 @@ find_field_in_table_ref(THD *thd, TABLE_LIST *table_list,
TODO: Ensure that table_name, db_name and tables->db always points to
something !
*/
if
(
/* Exclude n
atural joins and nested joins underlying natural
joins. */
(
!
(
table_list
->
nested_join
&&
table_list
->
join_columns
)
||
if
(
/* Exclude n
ested
joins. */
(
!
table_list
->
nested_join
||
/* Include merge views and information schema tables. */
table_list
->
field_translation
)
&&
/*
...
...
@@ -3025,13 +3025,10 @@ find_field_in_table_ref(THD *thd, TABLE_LIST *table_list,
register_tree_change
)))
*
actual_table
=
table_list
;
}
else
if
(
!
(
table_list
->
nested_join
&&
table_list
->
join_columns
)
)
else
if
(
!
table_list
->
nested_join
)
{
/*
'table_list' is a stored table. It is so because the only type of nested
join passed to this procedure is a NATURAL/USING join or an operand of a
NATURAL/USING join.
*/
/* 'table_list' is a stored table. */
DBUG_ASSERT
(
table_list
->
table
);
if
((
fld
=
find_field_in_table
(
thd
,
table_list
->
table
,
name
,
length
,
check_grants_table
,
allow_rowid
,
cached_field_index_ptr
)))
...
...
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