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
ff433d57
Commit
ff433d57
authored
Aug 06, 2004
by
igor@rurik.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge rurik.mysql.com:/home/igor/mysql-5.0
into rurik.mysql.com:/home/igor/dev/mysql-5.0-1
parents
7e1b6226
b805d125
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
3 deletions
+55
-3
mysql-test/r/join_nested.result
mysql-test/r/join_nested.result
+24
-0
mysql-test/t/join_nested.test
mysql-test/t/join_nested.test
+27
-0
sql/sql_select.cc
sql/sql_select.cc
+2
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+2
-2
No files found.
mysql-test/r/join_nested.result
View file @
ff433d57
...
...
@@ -1184,3 +1184,27 @@ a b a1 b
4 2 2 2
5 3 NULL NULL
DROP TABLE t0,t1,t2,t3,t4,t5,t6,t7,t8,t9;
CREATE TABLE t1 (a int);
CREATE TABLE t2 (a int);
CREATE TABLE t3 (a int);
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2);
INSERT INTO t3 VALUES (2);
INSERT INTO t1 VALUES (2);
SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON t2.a=t3.a) ON t1.a=t3.a;
a a a
1 NULL NULL
2 2 2
SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON t2.a=t3.a ON t1.a=t3.a;
a a a
1 NULL NULL
2 2 2
DELETE FROM t1 WHERE a=2;
SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON t2.a=t3.a ON t1.a=t3.a;
a a a
1 NULL NULL
DELETE FROM t2;
SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON t2.a=t3.a ON t1.a=t3.a;
a a a
1 NULL NULL
DROP TABLE t1,t2,t3;
mysql-test/t/join_nested.test
View file @
ff433d57
...
...
@@ -700,3 +700,30 @@ SELECT t2.a,t2.b,t3.a1,t3.b
WHERE
t2
.
a
=
4
OR
(
t2
.
a
>
4
AND
t3
.
a1
IS
NULL
);
DROP
TABLE
t0
,
t1
,
t2
,
t3
,
t4
,
t5
,
t6
,
t7
,
t8
,
t9
;
CREATE
TABLE
t1
(
a
int
);
CREATE
TABLE
t2
(
a
int
);
CREATE
TABLE
t3
(
a
int
);
INSERT
INTO
t1
VALUES
(
1
);
INSERT
INTO
t2
VALUES
(
2
);
INSERT
INTO
t3
VALUES
(
2
);
INSERT
INTO
t1
VALUES
(
2
);
#check proper syntax for nested outer joins
SELECT
*
FROM
t1
LEFT
JOIN
(
t2
LEFT
JOIN
t3
ON
t2
.
a
=
t3
.
a
)
ON
t1
.
a
=
t3
.
a
;
#must be equivalent to:
SELECT
*
FROM
t1
LEFT
JOIN
t2
LEFT
JOIN
t3
ON
t2
.
a
=
t3
.
a
ON
t1
.
a
=
t3
.
a
;
#check that everything is al right when all tables contain not more than 1 row
#(bug #4922)
DELETE
FROM
t1
WHERE
a
=
2
;
SELECT
*
FROM
t1
LEFT
JOIN
t2
LEFT
JOIN
t3
ON
t2
.
a
=
t3
.
a
ON
t1
.
a
=
t3
.
a
;
DELETE
FROM
t2
;
SELECT
*
FROM
t1
LEFT
JOIN
t2
LEFT
JOIN
t3
ON
t2
.
a
=
t3
.
a
ON
t1
.
a
=
t3
.
a
;
DROP
TABLE
t1
,
t2
,
t3
;
sql/sql_select.cc
View file @
ff433d57
...
...
@@ -2204,7 +2204,8 @@ make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds,
if
(
s
->
dependent
&
~
(
found_const_table_map
))
continue
;
if
(
table
->
file
->
records
<=
1L
&&
!
(
table
->
file
->
table_flags
()
&
HA_NOT_EXACT_COUNT
))
!
(
table
->
file
->
table_flags
()
&
HA_NOT_EXACT_COUNT
)
&&
!
table
->
pos_in_table_list
->
embedding
)
{
// system table
int
tmp
=
0
;
s
->
type
=
JT_SYSTEM
;
...
...
sql/sql_yacc.yy
View file @
ff433d57
...
...
@@ -4589,7 +4589,7 @@ join_table:
'(' using_list ')'
{ add_join_on($3,$7); $$=$3; }
| table_ref LEFT opt_outer JOIN_SYM table_
factor
ON expr
| table_ref LEFT opt_outer JOIN_SYM table_
ref
ON expr
{ add_join_on($5,$7); $5->outer_join|=JOIN_TYPE_LEFT; $$=$5; }
| table_ref LEFT opt_outer JOIN_SYM table_factor
{
...
...
@@ -4604,7 +4604,7 @@ join_table:
$6->outer_join|=JOIN_TYPE_LEFT;
$$=$6;
}
| table_ref RIGHT opt_outer JOIN_SYM table_
factor
ON expr
| table_ref RIGHT opt_outer JOIN_SYM table_
ref
ON expr
{
LEX *lex= Lex;
if (!($$= lex->current_select->convert_right_join()))
...
...
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