mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 21:42:35 +01:00
b62ac16185
Item_subselect::is_expensive() used to return FALSE (Inexpensive) whenever it saw that one of SELECTs in the Subquery's UNION is degenerate. It ignored the fact that other parts of the UNION might not be inexpensive, including the case where pther parts of the UNION have no query plan yet. For a subquery in form col >= ANY (SELECT 'foo' UNION SELECT 'bar') this would cause the query to be considered inexpensive when there is no query plan for the second part of the UNION, which in turn would cause the SELECT 'foo' to compute and free itself while still inside JOIN::optimize for that SELECT (See MDEV comment for full description).
38 lines
1.1 KiB
Text
38 lines
1.1 KiB
Text
set @subselect_extra_no_sj_tmp=@@optimizer_switch;
|
|
|
|
set @optimizer_switch_for_subselect_extra_test='semijoin=off,firstmatch=off,loosescan=off,semijoin_with_cache=off';
|
|
|
|
--source t/subselect_extra.test
|
|
|
|
set optimizer_switch= @subselect_extra_no_sj_tmp;
|
|
|
|
set @optimizer_switch_for_subselect_extra_test=null;
|
|
|
|
--echo #
|
|
--echo # MDEV-6439: Server crashes in Explain_union::print_explain with explain in slow log, tis620 charset
|
|
--echo #
|
|
|
|
## Using a separate client connection is easier than restoring state
|
|
connect(con1,localhost,root,,);
|
|
|
|
SET NAMES tis620;
|
|
set @tmp= @@global.slow_query_log;
|
|
SET GLOBAL slow_query_log = 1;
|
|
SET long_query_time = 0.000001;
|
|
SET log_slow_verbosity = 'explain';
|
|
|
|
CREATE TABLE t1 (a VARCHAR(3)) ENGINE=MyISAM;
|
|
SELECT * FROM t1 WHERE a >= ANY ( SELECT 'foo');
|
|
--error ER_CANT_AGGREGATE_2COLLATIONS
|
|
SELECT * FROM t1 WHERE a >= ANY ( SELECT 'foo' UNION SELECT 'bar' );
|
|
|
|
create table t2 (b int);
|
|
insert into t2 values (1),(2),(3);
|
|
|
|
--error ER_CANT_AGGREGATE_2COLLATIONS
|
|
SELECT * FROM t1 WHERE a >= ANY ( SELECT 'foo' FROM t2);
|
|
|
|
drop table t1,t2;
|
|
SET GLOBAL slow_query_log=@tmp;
|
|
disconnect con1;
|
|
connection default;
|