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
1153d656
Commit
1153d656
authored
Mar 21, 2012
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Plain Diff
Merge BUG#952372
parents
357331af
5805908b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
2 deletions
+70
-2
mysql-test/r/subselect_sj.result
mysql-test/r/subselect_sj.result
+22
-0
mysql-test/r/subselect_sj_jcl6.result
mysql-test/r/subselect_sj_jcl6.result
+22
-0
mysql-test/t/subselect_sj.test
mysql-test/t/subselect_sj.test
+21
-0
sql/opt_subselect.cc
sql/opt_subselect.cc
+5
-2
No files found.
mysql-test/r/subselect_sj.result
View file @
1153d656
...
...
@@ -2639,4 +2639,26 @@ INSERT INTO t1
SELECT * FROM ( SELECT * FROM t1 ) AS alias
WHERE a IN ( SELECT b FROM t2 );
DROP TABLE t1, t2;
#
# BUG#952372: Server crashes on 2nd execution of PS in find_field_in_tables with semijoin+materialization
#
CREATE TABLE t1 ( a INT );
INSERT INTO t1 VALUES (2),(3);
CREATE VIEW v1 AS SELECT * FROM t1;
CREATE TABLE t2 ( b VARCHAR(1) );
INSERT INTO t2 VALUES ('v'),('v');
PREPARE pstmt FROM
'SELECT DISTINCT a FROM v1, t2
WHERE b IN ( SELECT MIN(b) FROM t2 )';
EXECUTE pstmt;
a
2
3
EXECUTE pstmt;
a
2
3
DEALLOCATE PREPARE pstmt;
DROP VIEW v1;
DROP TABLE t1, t2;
set optimizer_switch=@subselect_sj_tmp;
mysql-test/r/subselect_sj_jcl6.result
View file @
1153d656
...
...
@@ -2653,6 +2653,28 @@ INSERT INTO t1
SELECT * FROM ( SELECT * FROM t1 ) AS alias
WHERE a IN ( SELECT b FROM t2 );
DROP TABLE t1, t2;
#
# BUG#952372: Server crashes on 2nd execution of PS in find_field_in_tables with semijoin+materialization
#
CREATE TABLE t1 ( a INT );
INSERT INTO t1 VALUES (2),(3);
CREATE VIEW v1 AS SELECT * FROM t1;
CREATE TABLE t2 ( b VARCHAR(1) );
INSERT INTO t2 VALUES ('v'),('v');
PREPARE pstmt FROM
'SELECT DISTINCT a FROM v1, t2
WHERE b IN ( SELECT MIN(b) FROM t2 )';
EXECUTE pstmt;
a
2
3
EXECUTE pstmt;
a
2
3
DEALLOCATE PREPARE pstmt;
DROP VIEW v1;
DROP TABLE t1, t2;
set optimizer_switch=@subselect_sj_tmp;
#
# BUG#49129: Wrong result with IN-subquery with join_cache_level=6 and firstmatch=off
...
...
mysql-test/t/subselect_sj.test
View file @
1153d656
...
...
@@ -2345,5 +2345,26 @@ WHERE a IN ( SELECT b FROM t2 );
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# BUG#952372: Server crashes on 2nd execution of PS in find_field_in_tables with semijoin+materialization
--
echo
#
CREATE
TABLE
t1
(
a
INT
);
INSERT
INTO
t1
VALUES
(
2
),(
3
);
CREATE
VIEW
v1
AS
SELECT
*
FROM
t1
;
CREATE
TABLE
t2
(
b
VARCHAR
(
1
)
);
INSERT
INTO
t2
VALUES
(
'v'
),(
'v'
);
PREPARE
pstmt
FROM
'SELECT DISTINCT a FROM v1, t2
WHERE b IN ( SELECT MIN(b) FROM t2 )'
;
EXECUTE
pstmt
;
EXECUTE
pstmt
;
DEALLOCATE
PREPARE
pstmt
;
DROP
VIEW
v1
;
DROP
TABLE
t1
,
t2
;
# The following command must be the last one the file
set
optimizer_switch
=@
subselect_sj_tmp
;
sql/opt_subselect.cc
View file @
1153d656
...
...
@@ -1250,7 +1250,10 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
(a theory: a next_local chain always starts with ::leaf_tables
because view's tables are inserted after the view)
*/
for
(
tl
=
parent_lex
->
leaf_tables
.
head
();
tl
->
next_local
;
tl
=
tl
->
next_local
)
;
for
(
tl
=
(
TABLE_LIST
*
)(
parent_lex
->
table_list
.
first
);
tl
->
next_local
;
tl
=
tl
->
next_local
)
{}
tl
->
next_local
=
subq_lex
->
leaf_tables
.
head
();
/* A theory: no need to re-connect the next_global chain */
...
...
@@ -1463,7 +1466,7 @@ static bool convert_subq_to_jtbm(JOIN *parent_join,
(a theory: a next_local chain always starts with ::leaf_tables
because view's tables are inserted after the view)
*/
for
(
tl
=
parent_lex
->
leaf_tables
.
head
(
);
tl
->
next_local
;
tl
=
tl
->
next_local
)
for
(
tl
=
(
TABLE_LIST
*
)(
parent_lex
->
table_list
.
first
);
tl
->
next_local
;
tl
=
tl
->
next_local
)
{}
tl
->
next_local
=
jtbm
;
...
...
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