mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 04:22:27 +01:00
Merge fix for BUG#611704
This commit is contained in:
commit
271d9c21e6
4 changed files with 98 additions and 1 deletions
|
@ -1562,4 +1562,34 @@ f1
|
|||
1
|
||||
1
|
||||
DROP TABLE t1,t2,t3;
|
||||
#
|
||||
# BUG#611704: Crash in replace_where_subcondition with nested subquery and semijoin=on
|
||||
#
|
||||
CREATE TABLE t1 ( f1 int) ;
|
||||
CREATE TABLE t2 ( f1 int) ;
|
||||
CREATE TABLE t3 ( f1 int) ;
|
||||
SELECT * FROM (
|
||||
SELECT t3.*
|
||||
FROM t2 STRAIGHT_JOIN t3
|
||||
ON t3.f1
|
||||
AND (t3.f1 ) IN (
|
||||
SELECT t1.f1
|
||||
FROM t1
|
||||
)
|
||||
) AS alias1;
|
||||
f1
|
||||
DROP TABLE t1,t2,t3;
|
||||
# BUG#611704: another testcase:
|
||||
CREATE TABLE t1 ( f1 int(11), f3 varchar(1), f4 varchar(1)) ;
|
||||
CREATE TABLE t2 ( f2 int(11), KEY (f2));
|
||||
CREATE TABLE t3 ( f4 varchar(1)) ;
|
||||
PREPARE st1 FROM '
|
||||
SELECT *
|
||||
FROM t1
|
||||
STRAIGHT_JOIN ( t2 STRAIGHT_JOIN t3 ON t2.f2 )
|
||||
ON (t1.f3) IN ( SELECT f4 FROM t1 )
|
||||
';
|
||||
EXECUTE st1;
|
||||
f1 f3 f4 f2 f4
|
||||
DROP TABLE t1,t2,t3;
|
||||
set optimizer_switch=@subselect_sj_tmp;
|
||||
|
|
|
@ -1571,6 +1571,36 @@ f1
|
|||
1
|
||||
1
|
||||
DROP TABLE t1,t2,t3;
|
||||
#
|
||||
# BUG#611704: Crash in replace_where_subcondition with nested subquery and semijoin=on
|
||||
#
|
||||
CREATE TABLE t1 ( f1 int) ;
|
||||
CREATE TABLE t2 ( f1 int) ;
|
||||
CREATE TABLE t3 ( f1 int) ;
|
||||
SELECT * FROM (
|
||||
SELECT t3.*
|
||||
FROM t2 STRAIGHT_JOIN t3
|
||||
ON t3.f1
|
||||
AND (t3.f1 ) IN (
|
||||
SELECT t1.f1
|
||||
FROM t1
|
||||
)
|
||||
) AS alias1;
|
||||
f1
|
||||
DROP TABLE t1,t2,t3;
|
||||
# BUG#611704: another testcase:
|
||||
CREATE TABLE t1 ( f1 int(11), f3 varchar(1), f4 varchar(1)) ;
|
||||
CREATE TABLE t2 ( f2 int(11), KEY (f2));
|
||||
CREATE TABLE t3 ( f4 varchar(1)) ;
|
||||
PREPARE st1 FROM '
|
||||
SELECT *
|
||||
FROM t1
|
||||
STRAIGHT_JOIN ( t2 STRAIGHT_JOIN t3 ON t2.f2 )
|
||||
ON (t1.f3) IN ( SELECT f4 FROM t1 )
|
||||
';
|
||||
EXECUTE st1;
|
||||
f1 f3 f4 f2 f4
|
||||
DROP TABLE t1,t2,t3;
|
||||
set optimizer_switch=@subselect_sj_tmp;
|
||||
#
|
||||
# BUG#49129: Wrong result with IN-subquery with join_cache_level=6 and firstmatch=off
|
||||
|
|
|
@ -1424,5 +1424,40 @@ WHERE t1.f1 IN (
|
|||
|
||||
DROP TABLE t1,t2,t3;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # BUG#611704: Crash in replace_where_subcondition with nested subquery and semijoin=on
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 ( f1 int) ;
|
||||
CREATE TABLE t2 ( f1 int) ;
|
||||
CREATE TABLE t3 ( f1 int) ;
|
||||
|
||||
SELECT * FROM (
|
||||
SELECT t3.*
|
||||
FROM t2 STRAIGHT_JOIN t3
|
||||
ON t3.f1
|
||||
AND (t3.f1 ) IN (
|
||||
SELECT t1.f1
|
||||
FROM t1
|
||||
)
|
||||
) AS alias1;
|
||||
DROP TABLE t1,t2,t3;
|
||||
|
||||
--echo # BUG#611704: another testcase:
|
||||
CREATE TABLE t1 ( f1 int(11), f3 varchar(1), f4 varchar(1)) ;
|
||||
CREATE TABLE t2 ( f2 int(11), KEY (f2));
|
||||
CREATE TABLE t3 ( f4 varchar(1)) ;
|
||||
|
||||
PREPARE st1 FROM '
|
||||
SELECT *
|
||||
FROM t1
|
||||
STRAIGHT_JOIN ( t2 STRAIGHT_JOIN t3 ON t2.f2 )
|
||||
ON (t1.f3) IN ( SELECT f4 FROM t1 )
|
||||
';
|
||||
EXECUTE st1;
|
||||
DROP TABLE t1,t2,t3;
|
||||
|
||||
|
||||
# The following command must be the last one the file
|
||||
set optimizer_switch=@subselect_sj_tmp;
|
||||
|
|
|
@ -3413,7 +3413,9 @@ bool SELECT_LEX::merge_subquery(TABLE_LIST *derived, SELECT_LEX *subq_select,
|
|||
in_subq++)
|
||||
{
|
||||
join->sj_subselects.append(join->thd->mem_root, *in_subq);
|
||||
(*in_subq)->emb_on_expr_nest= derived;
|
||||
DBUG_ASSERT((*in_subq)->emb_on_expr_nest != NULL);
|
||||
if ((*in_subq)->emb_on_expr_nest == NO_JOIN_NEST)
|
||||
(*in_subq)->emb_on_expr_nest= derived;
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue