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
178c6ece
Commit
178c6ece
authored
Nov 02, 2011
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
483fe0ad
9b761df3
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
4 deletions
+82
-4
mysql-test/r/subselect_sj.result
mysql-test/r/subselect_sj.result
+24
-0
mysql-test/r/subselect_sj_jcl6.result
mysql-test/r/subselect_sj_jcl6.result
+24
-0
mysql-test/t/subselect_sj.test
mysql-test/t/subselect_sj.test
+25
-0
sql/opt_subselect.cc
sql/opt_subselect.cc
+9
-4
No files found.
mysql-test/r/subselect_sj.result
View file @
178c6ece
...
...
@@ -1994,4 +1994,28 @@ a
20
DROP TABLE t1,t2,t3;
set optimizer_switch=@tmp_877288;
#
# BUG#878753: Assertion '0' failed in replace_where_subcondition with derived_merge
#
set @tmp878753= @@optimizer_switch;
set optimizer_switch= 'semijoin=on,derived_merge=on';
CREATE TABLE t1 (b int(11)) ;
CREATE TABLE t2 (c int, b int, d varchar(52) NOT NULL) ;
CREATE TABLE t3 (b int(11)) ;
PREPARE st1 FROM '
SELECT * FROM t1
JOIN (
SELECT t2.* FROM t2
WHERE t2.d <> "a"
AND t2.c IN (
SELECT t3.b
FROM t3
)
) AS alias2
ON ( alias2.b = t1.b );
';
EXECUTE st1;
b c b d
DROP TABLE t1,t2,t3;
set optimizer_switch=@tmp878753;
set optimizer_switch=@subselect_sj_tmp;
mysql-test/r/subselect_sj_jcl6.result
View file @
178c6ece
...
...
@@ -2005,6 +2005,30 @@ a
20
DROP TABLE t1,t2,t3;
set optimizer_switch=@tmp_877288;
#
# BUG#878753: Assertion '0' failed in replace_where_subcondition with derived_merge
#
set @tmp878753= @@optimizer_switch;
set optimizer_switch= 'semijoin=on,derived_merge=on';
CREATE TABLE t1 (b int(11)) ;
CREATE TABLE t2 (c int, b int, d varchar(52) NOT NULL) ;
CREATE TABLE t3 (b int(11)) ;
PREPARE st1 FROM '
SELECT * FROM t1
JOIN (
SELECT t2.* FROM t2
WHERE t2.d <> "a"
AND t2.c IN (
SELECT t3.b
FROM t3
)
) AS alias2
ON ( alias2.b = t1.b );
';
EXECUTE st1;
b c b d
DROP TABLE t1,t2,t3;
set optimizer_switch=@tmp878753;
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 @
178c6ece
...
...
@@ -1827,5 +1827,30 @@ SELECT * FROM t1 WHERE (a) IN (SELECT a FROM t2 JOIN t3 ON b = a);
DROP
TABLE
t1
,
t2
,
t3
;
set
optimizer_switch
=@
tmp_877288
;
--
echo
#
--
echo
# BUG#878753: Assertion '0' failed in replace_where_subcondition with derived_merge
--
echo
#
set
@
tmp878753
=
@@
optimizer_switch
;
set
optimizer_switch
=
'semijoin=on,derived_merge=on'
;
CREATE
TABLE
t1
(
b
int
(
11
))
;
CREATE
TABLE
t2
(
c
int
,
b
int
,
d
varchar
(
52
)
NOT
NULL
)
;
CREATE
TABLE
t3
(
b
int
(
11
))
;
PREPARE
st1
FROM
'
SELECT * FROM t1
JOIN (
SELECT t2.* FROM t2
WHERE t2.d <> "a"
AND t2.c IN (
SELECT t3.b
FROM t3
)
) AS alias2
ON ( alias2.b = t1.b );
'
;
EXECUTE
st1
;
DROP
TABLE
t1
,
t2
,
t3
;
set
optimizer_switch
=@
tmp878753
;
# The following command must be the last one the file
set
optimizer_switch
=@
subselect_sj_tmp
;
sql/opt_subselect.cc
View file @
178c6ece
...
...
@@ -1026,7 +1026,6 @@ static bool replace_where_subcondition(JOIN *join, Item **expr,
Item
*
old_cond
,
Item
*
new_cond
,
bool
do_fix_fields
)
{
//Item **expr= (emb_nest == (TABLE_LIST*)1)? &join->conds : &emb_nest->on_expr;
if
(
*
expr
==
old_cond
)
{
*
expr
=
new_cond
;
...
...
@@ -1050,9 +1049,15 @@ static bool replace_where_subcondition(JOIN *join, Item **expr,
}
}
}
// If we came here it means there were an error during prerequisites check.
DBUG_ASSERT
(
0
);
return
TRUE
;
/*
We can come to here when
- we're doing replace operations on both on_expr and prep_on_expr
- on_expr is the same as prep_on_expr, or they share a sub-tree
(so, when we do replace in on_expr, we replace in prep_on_expr, too,
and when we try doing a replace in prep_on_expr, the item we wanted
to replace there has already been replaced)
*/
return
FALSE
;
}
static
int
subq_sj_candidate_cmp
(
Item_in_subselect
*
el1
,
Item_in_subselect
*
el2
,
...
...
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