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
0f36ab3a
Commit
0f36ab3a
authored
Jul 07, 2011
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test for bug lp:612543
The bug itself has been fixed by MWL#89.
parent
5f5cbf76
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
93 additions
and
0 deletions
+93
-0
mysql-test/r/subselect4.result
mysql-test/r/subselect4.result
+57
-0
mysql-test/t/subselect4.test
mysql-test/t/subselect4.test
+36
-0
No files found.
mysql-test/r/subselect4.result
View file @
0f36ab3a
...
...
@@ -1883,4 +1883,61 @@ WHERE SUBQUERY2_t2.col_varchar_nokey IN
col_int_key
drop table t1, t2;
set @@optimizer_switch = @old_optimizer_switch;
#
# LP BUG#612543 Crash in Item_field::used_tables() with view + subquery + prepared statements
#
CREATE TABLE t1 ( f1 int(11), f2 varchar(1));
CREATE TABLE t2 ( f3 varchar(1));
insert into t1 values (2,'x'), (5,'y');
insert into t2 values ('x'), ('z');
CREATE VIEW v2 AS SELECT * FROM t2;
set @old_optimizer_switch = @@optimizer_switch;
set @@optimizer_switch='materialization=on,in_to_exists=off,semijoin=off,subquery_cache=off';
EXPLAIN SELECT * FROM t1 JOIN v2 ON t1.f2 > 'a' WHERE v2.f3 IN ( SELECT f2 FROM t1 );
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
PREPARE st1 FROM "SELECT * FROM t1 JOIN v2 ON t1.f2 > 'a' WHERE v2.f3 IN ( SELECT f2 FROM t1 )";
EXECUTE st1;
f1 f2 f3
2 x x
5 y x
EXECUTE st1;
f1 f2 f3
2 x x
5 y x
set @@optimizer_switch='materialization=off,in_to_exists=on,semijoin=off,subquery_cache=off';
EXPLAIN SELECT * FROM t1 JOIN v2 ON t1.f2 > 'a' WHERE v2.f3 IN ( SELECT f2 FROM t1 );
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
PREPARE st2 FROM "SELECT * FROM t1 JOIN v2 ON t1.f2 > 'a' WHERE v2.f3 IN ( SELECT f2 FROM t1 )";
EXECUTE st2;
f1 f2 f3
2 x x
5 y x
EXECUTE st2;
f1 f2 f3
2 x x
5 y x
set @@optimizer_switch='materialization=on,in_to_exists=on,semijoin=off,subquery_cache=off';
EXPLAIN SELECT * FROM t1 JOIN v2 ON t1.f2 > 'a' WHERE v2.f3 IN ( SELECT f2 FROM t1 );
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
PREPARE st3 FROM "SELECT * FROM t1 JOIN v2 ON t1.f2 > 'a' WHERE v2.f3 IN ( SELECT f2 FROM t1 )";
EXECUTE st3;
f1 f2 f3
2 x x
5 y x
EXECUTE st3;
f1 f2 f3
2 x x
5 y x
set @@optimizer_switch = @old_optimizer_switch;
drop table t1, t2;
drop view v2;
set optimizer_switch=@subselect4_tmp;
mysql-test/t/subselect4.test
View file @
0f36ab3a
...
...
@@ -1558,4 +1558,40 @@ drop table t1, t2;
set
@@
optimizer_switch
=
@
old_optimizer_switch
;
--
echo
#
--
echo
# LP BUG#612543 Crash in Item_field::used_tables() with view + subquery + prepared statements
--
echo
#
CREATE
TABLE
t1
(
f1
int
(
11
),
f2
varchar
(
1
));
CREATE
TABLE
t2
(
f3
varchar
(
1
));
insert
into
t1
values
(
2
,
'x'
),
(
5
,
'y'
);
insert
into
t2
values
(
'x'
),
(
'z'
);
CREATE
VIEW
v2
AS
SELECT
*
FROM
t2
;
set
@
old_optimizer_switch
=
@@
optimizer_switch
;
set
@@
optimizer_switch
=
'materialization=on,in_to_exists=off,semijoin=off,subquery_cache=off'
;
EXPLAIN
SELECT
*
FROM
t1
JOIN
v2
ON
t1
.
f2
>
'a'
WHERE
v2
.
f3
IN
(
SELECT
f2
FROM
t1
);
PREPARE
st1
FROM
"SELECT * FROM t1 JOIN v2 ON t1.f2 > 'a' WHERE v2.f3 IN ( SELECT f2 FROM t1 )"
;
EXECUTE
st1
;
EXECUTE
st1
;
set
@@
optimizer_switch
=
'materialization=off,in_to_exists=on,semijoin=off,subquery_cache=off'
;
EXPLAIN
SELECT
*
FROM
t1
JOIN
v2
ON
t1
.
f2
>
'a'
WHERE
v2
.
f3
IN
(
SELECT
f2
FROM
t1
);
PREPARE
st2
FROM
"SELECT * FROM t1 JOIN v2 ON t1.f2 > 'a' WHERE v2.f3 IN ( SELECT f2 FROM t1 )"
;
EXECUTE
st2
;
EXECUTE
st2
;
set
@@
optimizer_switch
=
'materialization=on,in_to_exists=on,semijoin=off,subquery_cache=off'
;
EXPLAIN
SELECT
*
FROM
t1
JOIN
v2
ON
t1
.
f2
>
'a'
WHERE
v2
.
f3
IN
(
SELECT
f2
FROM
t1
);
PREPARE
st3
FROM
"SELECT * FROM t1 JOIN v2 ON t1.f2 > 'a' WHERE v2.f3 IN ( SELECT f2 FROM t1 )"
;
EXECUTE
st3
;
EXECUTE
st3
;
set
@@
optimizer_switch
=
@
old_optimizer_switch
;
drop
table
t1
,
t2
;
drop
view
v2
;
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