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
e98aecc2
Commit
e98aecc2
authored
Jul 08, 2011
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test for bug lp:611382
The bug itself has been fixed by MWL#89.
parent
57432d0c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
0 deletions
+76
-0
mysql-test/r/subselect4.result
mysql-test/r/subselect4.result
+38
-0
mysql-test/t/subselect4.test
mysql-test/t/subselect4.test
+38
-0
No files found.
mysql-test/r/subselect4.result
View file @
e98aecc2
...
...
@@ -1973,4 +1973,42 @@ f1 (SELECT f2 FROM t1 WHERE (7) IN (SELECT f1 FROM t1))
23 NULL
set @@optimizer_switch = @old_optimizer_switch;
drop table t1, t2, t3;
#
# LP BUG#611382 RQG: Query returns extra rows when executed with materialization=on
#
CREATE TABLE t1 ( f4 varchar(1)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (NULL);
CREATE TABLE t2 ( f2 date, f3 varchar(1), f4 varchar(1)) ;
INSERT INTO t2 VALUES ('2005-05-03','c','c'),('1900-01-01','d','d');
CREATE TABLE t3 ( f3 varchar(1)) ;
INSERT INTO t3 VALUES ('c');
set @old_optimizer_switch = @@optimizer_switch;
set @@optimizer_switch = 'materialization=on,in_to_exists=off,semijoin=off';
EXPLAIN SELECT t1.f4
FROM t1 JOIN ( t2 JOIN t3 ON t3.f3 = t2.f4 ) ON t3.f3 = t2.f3
WHERE t1.f4 IN ( SELECT f4 FROM t2 ) ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1
1 PRIMARY t3 system NULL NULL NULL NULL 1
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2
SELECT t1.f4
FROM t1 JOIN ( t2 JOIN t3 ON t3.f3 = t2.f4 ) ON t3.f3 = t2.f3
WHERE t1.f4 IN ( SELECT f4 FROM t2 ) ;
f4
set @@optimizer_switch = 'materialization=off,in_to_exists=on,semijoin=off';
EXPLAIN SELECT t1.f4
FROM t1 JOIN ( t2 JOIN t3 ON t3.f3 = t2.f4 ) ON t3.f3 = t2.f3
WHERE t1.f4 IN ( SELECT f4 FROM t2 ) ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1
1 PRIMARY t3 system NULL NULL NULL NULL 1
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
SELECT t1.f4
FROM t1 JOIN ( t2 JOIN t3 ON t3.f3 = t2.f4 ) ON t3.f3 = t2.f3
WHERE t1.f4 IN ( SELECT f4 FROM t2 ) ;
f4
set @@optimizer_switch = @old_optimizer_switch;
drop table t1, t2, t3;
set optimizer_switch=@subselect4_tmp;
mysql-test/t/subselect4.test
View file @
e98aecc2
...
...
@@ -1627,4 +1627,42 @@ set @@optimizer_switch = @old_optimizer_switch;
drop
table
t1
,
t2
,
t3
;
--
echo
#
--
echo
# LP BUG#611382 RQG: Query returns extra rows when executed with materialization=on
--
echo
#
CREATE
TABLE
t1
(
f4
varchar
(
1
))
ENGINE
=
MyISAM
;
INSERT
INTO
t1
VALUES
(
NULL
);
CREATE
TABLE
t2
(
f2
date
,
f3
varchar
(
1
),
f4
varchar
(
1
))
;
INSERT
INTO
t2
VALUES
(
'2005-05-03'
,
'c'
,
'c'
),(
'1900-01-01'
,
'd'
,
'd'
);
CREATE
TABLE
t3
(
f3
varchar
(
1
))
;
INSERT
INTO
t3
VALUES
(
'c'
);
set
@
old_optimizer_switch
=
@@
optimizer_switch
;
set
@@
optimizer_switch
=
'materialization=on,in_to_exists=off,semijoin=off'
;
EXPLAIN
SELECT
t1
.
f4
FROM
t1
JOIN
(
t2
JOIN
t3
ON
t3
.
f3
=
t2
.
f4
)
ON
t3
.
f3
=
t2
.
f3
WHERE
t1
.
f4
IN
(
SELECT
f4
FROM
t2
)
;
SELECT
t1
.
f4
FROM
t1
JOIN
(
t2
JOIN
t3
ON
t3
.
f3
=
t2
.
f4
)
ON
t3
.
f3
=
t2
.
f3
WHERE
t1
.
f4
IN
(
SELECT
f4
FROM
t2
)
;
set
@@
optimizer_switch
=
'materialization=off,in_to_exists=on,semijoin=off'
;
EXPLAIN
SELECT
t1
.
f4
FROM
t1
JOIN
(
t2
JOIN
t3
ON
t3
.
f3
=
t2
.
f4
)
ON
t3
.
f3
=
t2
.
f3
WHERE
t1
.
f4
IN
(
SELECT
f4
FROM
t2
)
;
SELECT
t1
.
f4
FROM
t1
JOIN
(
t2
JOIN
t3
ON
t3
.
f3
=
t2
.
f4
)
ON
t3
.
f3
=
t2
.
f3
WHERE
t1
.
f4
IN
(
SELECT
f4
FROM
t2
)
;
set
@@
optimizer_switch
=
@
old_optimizer_switch
;
drop
table
t1
,
t2
,
t3
;
set
optimizer_switch
=@
subselect4_tmp
;
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