Commit c450f7d8 authored by Alexander Barkov's avatar Alexander Barkov

Merge remote-tracking branch 'origin/5.5' into 10.0

parents 3661d988 15b92915
......@@ -713,6 +713,23 @@ a ct
set sql_mode=@save_sql_mode;
drop table t1;
#
# mdev-16235: impossible HAVING in query without aggregation
#
explain extended
select * from mysql.help_topic where example = 'foo' having description is null;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING
Warnings:
Note 1003 select `mysql`.`help_topic`.`help_topic_id` AS `help_topic_id`,`mysql`.`help_topic`.`name` AS `name`,`mysql`.`help_topic`.`help_category_id` AS `help_category_id`,`mysql`.`help_topic`.`description` AS `description`,`mysql`.`help_topic`.`example` AS `example`,`mysql`.`help_topic`.`url` AS `url` from `mysql`.`help_topic` where (`mysql`.`help_topic`.`example` = 'foo') having 0
select * from mysql.help_topic where example = 'foo' having description is null;
help_topic_id name help_category_id description example url
#
# End of 5. tests
#
#
# Start of 10.0 tests
#
#
# Bug mdev-5160: two-way join with HAVING over the second table
#
CREATE TABLE t1 (c1 varchar(6)) ENGINE=MyISAM;
......
......@@ -1043,7 +1043,7 @@ EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No matching min/max row
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10);
f1 f2
SET @@optimizer_switch = 'materialization=off,in_to_exists=on,semijoin=off';
......@@ -1134,7 +1134,7 @@ EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No matching min/max row
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10);
f1 f2
set @@optimizer_switch=@save_optimizer_switch;
......
This diff was suppressed by a .gitattributes entry.
......@@ -354,5 +354,15 @@ a b c
DROP TABLE t1;
SET sql_mode=DEFAULT;
#
# MDEV-15834 The code in TABLE_SHARE::init_from_binary_frm_image() is not safe
#
SHOW TABLES;
Tables_in_test
t1
SHOW CREATE TABLE t1;
ERROR HY000: Incorrect information in file: './test/t1.frm'
ALTER TABLE t1;
ERROR HY000: Incorrect information in file: './test/t1.frm'
#
# End of 5.5 tests
#
--source include/have_ucs2.inc
let $MYSQLD_DATADIR= `select @@datadir`;
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
......@@ -318,6 +320,20 @@ SELECT * FROM t1;
DROP TABLE t1;
SET sql_mode=DEFAULT;
--echo #
--echo # MDEV-15834 The code in TABLE_SHARE::init_from_binary_frm_image() is not safe
--echo #
--copy_file std_data/frm/t1.frm $MYSQLD_DATADIR/test/t1.frm
SHOW TABLES;
--error ER_NOT_FORM_FILE
SHOW CREATE TABLE t1;
--error ER_NOT_FORM_FILE
ALTER TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1.frm
--echo #
--echo # End of 5.5 tests
--echo #
......@@ -745,6 +745,23 @@ set sql_mode=@save_sql_mode;
drop table t1;
--echo #
--echo # mdev-16235: impossible HAVING in query without aggregation
--echo #
explain extended
select * from mysql.help_topic where example = 'foo' having description is null;
select * from mysql.help_topic where example = 'foo' having description is null;
--echo #
--echo # End of 5. tests
--echo #
--echo #
--echo # Start of 10.0 tests
--echo #
--echo #
--echo # Bug mdev-5160: two-way join with HAVING over the second table
--echo #
......
......@@ -5937,6 +5937,7 @@ bool JOIN::choose_tableless_subquery_plan()
functions produce empty subquery result. There is no need to further
rewrite the subquery because it will not be executed at all.
*/
exec_const_cond= 0;
return FALSE;
}
......@@ -5968,6 +5969,6 @@ bool JOIN::choose_tableless_subquery_plan()
tmp_having= having;
}
}
exec_const_cond= conds;
exec_const_cond= zero_result_cause ? 0 : conds;
return FALSE;
}
......@@ -1256,7 +1256,6 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S
{
DBUG_PRINT("info", ("Zero limit"));
zero_result_cause= "Zero limit";
conds= 0;
}
table_count= top_join_tab_count= 0;
error= 0;
......
......@@ -1499,7 +1499,8 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
if ((uchar)field_type == (uchar)MYSQL_TYPE_VIRTUAL)
{
DBUG_ASSERT(interval_nr); // Expect non-null expression
if (!interval_nr) // Expect non-null expression
goto err;
/*
The interval_id byte in the .frm file stores the length of the
expression statement for a virtual column.
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment