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
5f5cbf76
Commit
5f5cbf76
authored
Jul 07, 2011
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test case for bug lp:611690
The bug itself has been fixed by MWL#89.
parent
4128ec48
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
132 additions
and
0 deletions
+132
-0
mysql-test/r/subselect4.result
mysql-test/r/subselect4.result
+68
-0
mysql-test/t/subselect4.test
mysql-test/t/subselect4.test
+64
-0
No files found.
mysql-test/r/subselect4.result
View file @
5f5cbf76
...
@@ -1815,4 +1815,72 @@ SELECT DISTINCT f4
...
@@ -1815,4 +1815,72 @@ SELECT DISTINCT f4
FROM t1));
FROM t1));
f2 f1
f2 f1
drop table t1, t2, t3, t4;
drop table t1, t2, t3, t4;
#
# LP BUG#611690 Crash in select_describe() with nested subqueries
#
CREATE TABLE t1 (
col_int_key int(11) DEFAULT NULL,
col_varchar_key varchar(1) DEFAULT NULL,
col_varchar_nokey varchar(1) DEFAULT NULL,
KEY col_int_key (col_int_key),
KEY col_varchar_key (col_varchar_key,col_int_key)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO t1 VALUES (8,'v','v');
INSERT INTO t1 VALUES (9,'r','r');
CREATE TABLE t2 (
col_int_key int(11) DEFAULT NULL,
col_varchar_key varchar(1) DEFAULT NULL,
col_varchar_nokey varchar(1) DEFAULT NULL,
KEY col_int_key (col_int_key),
KEY col_varchar_key (col_varchar_key,col_int_key)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO t2 VALUES (2,'w','w');
INSERT INTO t2 VALUES (9,'m','m');
set @old_optimizer_switch = @@optimizer_switch;
set @@optimizer_switch='subquery_cache=off,materialization=on,in_to_exists=off,semijoin=off';
EXPLAIN
SELECT col_int_key
FROM t2
WHERE (SELECT SUBQUERY2_t1.col_int_key
FROM t1 SUBQUERY2_t1 STRAIGHT_JOIN t1 SUBQUERY2_t2
ON SUBQUERY2_t2.col_varchar_key
WHERE SUBQUERY2_t2.col_varchar_nokey IN
(SELECT col_varchar_nokey FROM t1 GROUP BY col_varchar_nokey));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 index NULL col_int_key 5 NULL 2 Using index
2 SUBQUERY SUBQUERY2_t1 index NULL col_int_key 5 NULL 2 Using index
2 SUBQUERY SUBQUERY2_t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary
SELECT col_int_key
FROM t2
WHERE (SELECT SUBQUERY2_t1.col_int_key
FROM t1 SUBQUERY2_t1 STRAIGHT_JOIN t1 SUBQUERY2_t2
ON SUBQUERY2_t2.col_varchar_key
WHERE SUBQUERY2_t2.col_varchar_nokey IN
(SELECT col_varchar_nokey FROM t1 GROUP BY col_varchar_nokey));
col_int_key
set @@optimizer_switch='subquery_cache=off,materialization=off,in_to_exists=on,semijoin=off';
EXPLAIN
SELECT col_int_key
FROM t2
WHERE (SELECT SUBQUERY2_t1.col_int_key
FROM t1 SUBQUERY2_t1 STRAIGHT_JOIN t1 SUBQUERY2_t2
ON SUBQUERY2_t2.col_varchar_key
WHERE SUBQUERY2_t2.col_varchar_nokey IN
(SELECT col_varchar_nokey FROM t1 GROUP BY col_varchar_nokey));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 index NULL col_int_key 5 NULL 2 Using index
2 SUBQUERY SUBQUERY2_t1 index NULL col_int_key 5 NULL 2 Using index
2 SUBQUERY SUBQUERY2_t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary
SELECT col_int_key
FROM t2
WHERE (SELECT SUBQUERY2_t1.col_int_key
FROM t1 SUBQUERY2_t1 STRAIGHT_JOIN t1 SUBQUERY2_t2
ON SUBQUERY2_t2.col_varchar_key
WHERE SUBQUERY2_t2.col_varchar_nokey IN
(SELECT col_varchar_nokey FROM t1 GROUP BY col_varchar_nokey));
col_int_key
drop table t1, t2;
set @@optimizer_switch = @old_optimizer_switch;
set optimizer_switch=@subselect4_tmp;
set optimizer_switch=@subselect4_tmp;
mysql-test/t/subselect4.test
View file @
5f5cbf76
...
@@ -1494,4 +1494,68 @@ WHERE t3.f1 = (
...
@@ -1494,4 +1494,68 @@ WHERE t3.f1 = (
drop
table
t1
,
t2
,
t3
,
t4
;
drop
table
t1
,
t2
,
t3
,
t4
;
--
echo
#
--
echo
# LP BUG#611690 Crash in select_describe() with nested subqueries
--
echo
#
CREATE
TABLE
t1
(
col_int_key
int
(
11
)
DEFAULT
NULL
,
col_varchar_key
varchar
(
1
)
DEFAULT
NULL
,
col_varchar_nokey
varchar
(
1
)
DEFAULT
NULL
,
KEY
col_int_key
(
col_int_key
),
KEY
col_varchar_key
(
col_varchar_key
,
col_int_key
)
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
latin1
;
INSERT
INTO
t1
VALUES
(
8
,
'v'
,
'v'
);
INSERT
INTO
t1
VALUES
(
9
,
'r'
,
'r'
);
CREATE
TABLE
t2
(
col_int_key
int
(
11
)
DEFAULT
NULL
,
col_varchar_key
varchar
(
1
)
DEFAULT
NULL
,
col_varchar_nokey
varchar
(
1
)
DEFAULT
NULL
,
KEY
col_int_key
(
col_int_key
),
KEY
col_varchar_key
(
col_varchar_key
,
col_int_key
)
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
latin1
;
INSERT
INTO
t2
VALUES
(
2
,
'w'
,
'w'
);
INSERT
INTO
t2
VALUES
(
9
,
'm'
,
'm'
);
set
@
old_optimizer_switch
=
@@
optimizer_switch
;
set
@@
optimizer_switch
=
'subquery_cache=off,materialization=on,in_to_exists=off,semijoin=off'
;
EXPLAIN
SELECT
col_int_key
FROM
t2
WHERE
(
SELECT
SUBQUERY2_t1
.
col_int_key
FROM
t1
SUBQUERY2_t1
STRAIGHT_JOIN
t1
SUBQUERY2_t2
ON
SUBQUERY2_t2
.
col_varchar_key
WHERE
SUBQUERY2_t2
.
col_varchar_nokey
IN
(
SELECT
col_varchar_nokey
FROM
t1
GROUP
BY
col_varchar_nokey
));
SELECT
col_int_key
FROM
t2
WHERE
(
SELECT
SUBQUERY2_t1
.
col_int_key
FROM
t1
SUBQUERY2_t1
STRAIGHT_JOIN
t1
SUBQUERY2_t2
ON
SUBQUERY2_t2
.
col_varchar_key
WHERE
SUBQUERY2_t2
.
col_varchar_nokey
IN
(
SELECT
col_varchar_nokey
FROM
t1
GROUP
BY
col_varchar_nokey
));
set
@@
optimizer_switch
=
'subquery_cache=off,materialization=off,in_to_exists=on,semijoin=off'
;
EXPLAIN
SELECT
col_int_key
FROM
t2
WHERE
(
SELECT
SUBQUERY2_t1
.
col_int_key
FROM
t1
SUBQUERY2_t1
STRAIGHT_JOIN
t1
SUBQUERY2_t2
ON
SUBQUERY2_t2
.
col_varchar_key
WHERE
SUBQUERY2_t2
.
col_varchar_nokey
IN
(
SELECT
col_varchar_nokey
FROM
t1
GROUP
BY
col_varchar_nokey
));
SELECT
col_int_key
FROM
t2
WHERE
(
SELECT
SUBQUERY2_t1
.
col_int_key
FROM
t1
SUBQUERY2_t1
STRAIGHT_JOIN
t1
SUBQUERY2_t2
ON
SUBQUERY2_t2
.
col_varchar_key
WHERE
SUBQUERY2_t2
.
col_varchar_nokey
IN
(
SELECT
col_varchar_nokey
FROM
t1
GROUP
BY
col_varchar_nokey
));
drop
table
t1
,
t2
;
set
@@
optimizer_switch
=
@
old_optimizer_switch
;
set
optimizer_switch
=@
subselect4_tmp
;
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