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
48451b86
Commit
48451b86
authored
Jan 09, 2007
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk@192.168.21.1:mysql-5.0-opt
into mysql.com:/d2/hf/opt/my50-opt
parents
e3d81238
470ea99c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
105 additions
and
1 deletion
+105
-1
mysql-test/r/join_nested.result
mysql-test/r/join_nested.result
+43
-0
mysql-test/t/join_nested.test
mysql-test/t/join_nested.test
+51
-0
sql/sql_select.cc
sql/sql_select.cc
+11
-1
No files found.
mysql-test/r/join_nested.result
View file @
48451b86
...
...
@@ -1562,3 +1562,46 @@ id ngroupbynsa
2 1
2 1
DROP TABLE t1,t2,t3,t4,t5;
CREATE TABLE t1 (
id int NOT NULL PRIMARY KEY,
ct int DEFAULT NULL,
pc int DEFAULT NULL,
INDEX idx_ct (ct),
INDEX idx_pc (pc)
);
INSERT INTO t1 VALUES
(1,NULL,NULL),(2,NULL,NULL),(3,NULL,NULL),(4,NULL,NULL),(5,NULL,NULL);
CREATE TABLE t2 (
id int NOT NULL PRIMARY KEY,
sr int NOT NULL,
nm varchar(255) NOT NULL,
INDEX idx_sr (sr)
);
INSERT INTO t2 VALUES
(2441905,4308,'LesAbymes'),(2441906,4308,'Anse-Bertrand');
CREATE TABLE t3 (
id int NOT NULL PRIMARY KEY,
ct int NOT NULL,
ln int NOT NULL,
INDEX idx_ct (ct),
INDEX idx_ln (ln)
);
CREATE TABLE t4 (
id int NOT NULL PRIMARY KEY,
nm varchar(255) NOT NULL
);
INSERT INTO t4 VALUES (4308,'Guadeloupe'),(4309,'Martinique');
SELECT t1.*
FROM t1 LEFT JOIN
(t2 LEFT JOIN t3 ON t3.ct=t2.id AND t3.ln='5') ON t1.ct=t2.id
WHERE t1.id='5';
id ct pc
5 NULL NULL
SELECT t1.*, t4.nm
FROM t1 LEFT JOIN
(t2 LEFT JOIN t3 ON t3.ct=t2.id AND t3.ln='5') ON t1.ct=t2.id
LEFT JOIN t4 ON t2.sr=t4.id
WHERE t1.id='5';
id ct pc nm
5 NULL NULL NULL
DROP TABLE t1,t2,t3,t4;
mysql-test/t/join_nested.test
View file @
48451b86
...
...
@@ -994,3 +994,54 @@ SELECT t1.id1 AS id, t5.id1 AS ngroupbynsa
DROP
TABLE
t1
,
t2
,
t3
,
t4
,
t5
;
#
# Test for bug #24345: crash with nested left outer join when outer table is substituted
# for a row that happens to have a null value for the join attribute.
#
CREATE
TABLE
t1
(
id
int
NOT
NULL
PRIMARY
KEY
,
ct
int
DEFAULT
NULL
,
pc
int
DEFAULT
NULL
,
INDEX
idx_ct
(
ct
),
INDEX
idx_pc
(
pc
)
);
INSERT
INTO
t1
VALUES
(
1
,
NULL
,
NULL
),(
2
,
NULL
,
NULL
),(
3
,
NULL
,
NULL
),(
4
,
NULL
,
NULL
),(
5
,
NULL
,
NULL
);
CREATE
TABLE
t2
(
id
int
NOT
NULL
PRIMARY
KEY
,
sr
int
NOT
NULL
,
nm
varchar
(
255
)
NOT
NULL
,
INDEX
idx_sr
(
sr
)
);
INSERT
INTO
t2
VALUES
(
2441905
,
4308
,
'LesAbymes'
),(
2441906
,
4308
,
'Anse-Bertrand'
);
CREATE
TABLE
t3
(
id
int
NOT
NULL
PRIMARY
KEY
,
ct
int
NOT
NULL
,
ln
int
NOT
NULL
,
INDEX
idx_ct
(
ct
),
INDEX
idx_ln
(
ln
)
);
CREATE
TABLE
t4
(
id
int
NOT
NULL
PRIMARY
KEY
,
nm
varchar
(
255
)
NOT
NULL
);
INSERT
INTO
t4
VALUES
(
4308
,
'Guadeloupe'
),(
4309
,
'Martinique'
);
SELECT
t1
.*
FROM
t1
LEFT
JOIN
(
t2
LEFT
JOIN
t3
ON
t3
.
ct
=
t2
.
id
AND
t3
.
ln
=
'5'
)
ON
t1
.
ct
=
t2
.
id
WHERE
t1
.
id
=
'5'
;
SELECT
t1
.*
,
t4
.
nm
FROM
t1
LEFT
JOIN
(
t2
LEFT
JOIN
t3
ON
t3
.
ct
=
t2
.
id
AND
t3
.
ln
=
'5'
)
ON
t1
.
ct
=
t2
.
id
LEFT
JOIN
t4
ON
t2
.
sr
=
t4
.
id
WHERE
t1
.
id
=
'5'
;
DROP
TABLE
t1
,
t2
,
t3
,
t4
;
sql/sql_select.cc
View file @
48451b86
...
...
@@ -2305,8 +2305,18 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables, COND *conds,
substitution of a const table the key value happens to be null
then we can state that there are no matches for this equi-join.
*/
if
((
keyuse
=
s
->
keyuse
)
&&
*
s
->
on_expr_ref
)
if
((
keyuse
=
s
->
keyuse
)
&&
*
s
->
on_expr_ref
&&
!
s
->
embedding_map
)
{
/*
When performing an outer join operation if there are no matching rows
for the single row of the outer table all the inner tables are to be
null complemented and thus considered as constant tables.
Here we apply this consideration to the case of outer join operations
with a single inner table only because the case with nested tables
would require a more thorough analysis.
TODO. Apply single row substitution to null complemented inner tables
for nested outer join operations.
*/
while
(
keyuse
->
table
==
table
)
{
if
(
!
(
keyuse
->
val
->
used_tables
()
&
~
join
->
const_table_map
)
&&
...
...
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