mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
BUG#1002630: Valgrind warnings 'Invalid read' in subselect_engine::calc_const_tables with SELECT
- In JOIN::exec(), make the having->update_used_tables() call before we've made the JOIN::cleanup(full=true) call. The latter frees SJ-Materialization structures, which correlated subquery predicate items attempt to walk afterwards.
This commit is contained in:
@ -2743,4 +2743,18 @@ AND ( alias1.a1, alias2.a1 ) IN ( SELECT c1, c1 FROM t3 )
|
||||
GROUP BY field1;
|
||||
field1
|
||||
DROP TABLE t1,t3,t2;
|
||||
#
|
||||
# BUG#1002630: Valgrind warnings 'Invalid read' in subselect_engine::calc_const_tables with SELECT
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1),(7);
|
||||
CREATE TABLE t2 (b INT);
|
||||
INSERT INTO t2 VALUES (4),(6);
|
||||
SELECT ( SELECT SUM(a) FROM t1 ) AS t1sum, b
|
||||
FROM t2
|
||||
WHERE (1,1) IN ( SELECT MAX(a), MIN(a) FROM t1 )
|
||||
GROUP BY b
|
||||
HAVING t1sum <> 1;
|
||||
t1sum b
|
||||
DROP TABLE t1, t2;
|
||||
set optimizer_switch=@subselect_sj_tmp;
|
||||
|
@ -2757,6 +2757,20 @@ AND ( alias1.a1, alias2.a1 ) IN ( SELECT c1, c1 FROM t3 )
|
||||
GROUP BY field1;
|
||||
field1
|
||||
DROP TABLE t1,t3,t2;
|
||||
#
|
||||
# BUG#1002630: Valgrind warnings 'Invalid read' in subselect_engine::calc_const_tables with SELECT
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1),(7);
|
||||
CREATE TABLE t2 (b INT);
|
||||
INSERT INTO t2 VALUES (4),(6);
|
||||
SELECT ( SELECT SUM(a) FROM t1 ) AS t1sum, b
|
||||
FROM t2
|
||||
WHERE (1,1) IN ( SELECT MAX(a), MIN(a) FROM t1 )
|
||||
GROUP BY b
|
||||
HAVING t1sum <> 1;
|
||||
t1sum b
|
||||
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
|
||||
|
@ -2445,5 +2445,22 @@ GROUP BY field1;
|
||||
|
||||
DROP TABLE t1,t3,t2;
|
||||
|
||||
--echo #
|
||||
--echo # BUG#1002630: Valgrind warnings 'Invalid read' in subselect_engine::calc_const_tables with SELECT
|
||||
--echo #
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1),(7);
|
||||
|
||||
CREATE TABLE t2 (b INT);
|
||||
INSERT INTO t2 VALUES (4),(6);
|
||||
|
||||
SELECT ( SELECT SUM(a) FROM t1 ) AS t1sum, b
|
||||
FROM t2
|
||||
WHERE (1,1) IN ( SELECT MAX(a), MIN(a) FROM t1 )
|
||||
GROUP BY b
|
||||
HAVING t1sum <> 1;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
# The following command must be the last one the file
|
||||
set optimizer_switch=@subselect_sj_tmp;
|
||||
|
Reference in New Issue
Block a user