Commit f5b128df authored by Alexander Barkov's avatar Alexander Barkov

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

parents f7b1b2bc c450f7d8
...@@ -713,6 +713,23 @@ a ct ...@@ -713,6 +713,23 @@ a ct
set sql_mode=@save_sql_mode; set sql_mode=@save_sql_mode;
drop table t1; 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 # Bug mdev-5160: two-way join with HAVING over the second table
# #
CREATE TABLE t1 (c1 varchar(6)) ENGINE=MyISAM; CREATE TABLE t1 (c1 varchar(6)) ENGINE=MyISAM;
......
This diff was suppressed by a .gitattributes entry.
...@@ -354,6 +354,16 @@ a b c ...@@ -354,6 +354,16 @@ a b c
DROP TABLE t1; DROP TABLE t1;
SET sql_mode=DEFAULT; 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 # End of 5.5 tests
# #
# #
......
--source include/have_ucs2.inc --source include/have_ucs2.inc
let $MYSQLD_DATADIR= `select @@datadir`;
--disable_warnings --disable_warnings
drop table if exists t1,t2; drop table if exists t1,t2;
--enable_warnings --enable_warnings
...@@ -318,6 +320,20 @@ SELECT * FROM t1; ...@@ -318,6 +320,20 @@ SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
SET sql_mode=DEFAULT; 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 #
--echo # End of 5.5 tests --echo # End of 5.5 tests
--echo # --echo #
......
...@@ -745,6 +745,23 @@ set sql_mode=@save_sql_mode; ...@@ -745,6 +745,23 @@ set sql_mode=@save_sql_mode;
drop table t1; 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 #
--echo # Bug mdev-5160: two-way join with HAVING over the second table --echo # Bug mdev-5160: two-way join with HAVING over the second table
--echo # --echo #
......
...@@ -5955,6 +5955,7 @@ bool JOIN::choose_tableless_subquery_plan() ...@@ -5955,6 +5955,7 @@ bool JOIN::choose_tableless_subquery_plan()
functions produce empty subquery result. There is no need to further functions produce empty subquery result. There is no need to further
rewrite the subquery because it will not be executed at all. rewrite the subquery because it will not be executed at all.
*/ */
exec_const_cond= 0;
return FALSE; return FALSE;
} }
...@@ -5986,6 +5987,6 @@ bool JOIN::choose_tableless_subquery_plan() ...@@ -5986,6 +5987,6 @@ bool JOIN::choose_tableless_subquery_plan()
tmp_having= having; tmp_having= having;
} }
} }
exec_const_cond= conds; exec_const_cond= zero_result_cause ? 0 : conds;
return FALSE; return FALSE;
} }
...@@ -1261,7 +1261,6 @@ JOIN::optimize_inner() ...@@ -1261,7 +1261,6 @@ JOIN::optimize_inner()
{ {
DBUG_PRINT("info", ("Zero limit")); DBUG_PRINT("info", ("Zero limit"));
zero_result_cause= "Zero limit"; zero_result_cause= "Zero limit";
conds= 0;
} }
table_count= top_join_tab_count= 0; table_count= top_join_tab_count= 0;
error= 0; error= 0;
......
...@@ -1533,7 +1533,8 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, ...@@ -1533,7 +1533,8 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
if ((uchar)field_type == (uchar)MYSQL_TYPE_VIRTUAL) 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 The interval_id byte in the .frm file stores the length of the
expression statement for a virtual column. 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