diff options
Diffstat (limited to 'mysql-test/t')
-rw-r--r-- | mysql-test/t/connect_debug.test | 11 | ||||
-rw-r--r-- | mysql-test/t/derived.test | 4 | ||||
-rw-r--r-- | mysql-test/t/derived_view.test | 34 | ||||
-rw-r--r-- | mysql-test/t/information_schema_parameters.test | 2 | ||||
-rw-r--r-- | mysql-test/t/join.test | 404 | ||||
-rw-r--r-- | mysql-test/t/join_outer_innodb.test | 2 | ||||
-rw-r--r-- | mysql-test/t/plugin.test | 15 | ||||
-rw-r--r-- | mysql-test/t/ps.test | 77 | ||||
-rw-r--r-- | mysql-test/t/ps_innodb.test | 80 | ||||
-rw-r--r-- | mysql-test/t/subselect.test | 24 | ||||
-rw-r--r-- | mysql-test/t/view.test | 20 |
11 files changed, 671 insertions, 2 deletions
diff --git a/mysql-test/t/connect_debug.test b/mysql-test/t/connect_debug.test index 299b605b2cd..7a2f2872b79 100644 --- a/mysql-test/t/connect_debug.test +++ b/mysql-test/t/connect_debug.test @@ -1,3 +1,4 @@ +source include/not_embedded.inc; source include/have_debug.inc; set @old_dbug=@@global.debug_dbug; @@ -10,3 +11,13 @@ create user 'bad' identified by 'worse'; --exec $MYSQL --default-auth=mysql_old_password --user=bad --password=worse set global debug_dbug=@old_dbug; drop user bad; + +# +# malicious server, invalid plugin name +# +set global debug_dbug='+d,auth_invalid_plugin'; +create user 'bad' identified by 'worse'; +--error 1 +--exec $MYSQL --default-auth=mysql_old_password --user=bad --password=worse 2>&1 +set global debug_dbug=@old_dbug; +drop user bad; diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index c63eee546dc..470060d83db 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -533,6 +533,10 @@ insert into t2 values(4),(5),(6); select x.id, message from (select id from t1) x left join (select id, 1 as message from t2) y on x.id=y.id where coalesce(message,0) <> 0; +explain extended +select x.id, message from (select id from t1) x left join +(select id, 1 as message from t2) y on x.id=y.id +where message <> 0; drop table t1,t2; --echo # diff --git a/mysql-test/t/derived_view.test b/mysql-test/t/derived_view.test index ed9fb824940..ad0e0001b6b 100644 --- a/mysql-test/t/derived_view.test +++ b/mysql-test/t/derived_view.test @@ -2194,3 +2194,37 @@ JOIN ) gp_20 ON gp_20.id=t2.id ; DROP TABLE t1, t2; + +--echo # +--echo # MDEV-19778: equality condition for mergeable view returning constants +--echo # in its columns and used as inner table of outer join +--echo # + +create table t1 (pk int, a int); +insert into t1 values (1,7), (2,3), (3,2), (4,3); +create table t2 (b int); +insert into t2 values (5), (1), (NULL), (3); +create table t3 (c int); +insert into t3 values (1), (8); + +create view v1 as +select 3 as d, t2.b from t2; + +let $q= +select * from t1 left join v1 on t1.pk <= 2 where t1.a=v1.d; +eval $q; +eval explain extended $q; + +let $q= +select * from t1 left join (select 3 as d, t2.b from t2) dt on t1.pk <= 2 + where t1.a=dt.d; +eval $q; +eval explain extended $q; + +let $q= +select * from t1 left join (v1,t3) on t1.pk <= 2 where t1.a=v1.d; +eval $q; +eval explain extended $q; + +drop view v1; +drop table t1,t2,t3; diff --git a/mysql-test/t/information_schema_parameters.test b/mysql-test/t/information_schema_parameters.test index 3f0b11cba5f..0563941c17c 100644 --- a/mysql-test/t/information_schema_parameters.test +++ b/mysql-test/t/information_schema_parameters.test @@ -92,7 +92,7 @@ CREATE DATABASE i_s_parameters_test; USE i_s_parameters_test; delimiter //; -CREATE PROCEDURE testproc (OUT param1 INT) +CREATE PROCEDURE testproc (IN param1 INT) BEGIN SELECT 2+2 as param1; END; diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test index 3d2a02e2346..632ee947940 100644 --- a/mysql-test/t/join.test +++ b/mysql-test/t/join.test @@ -1210,6 +1210,410 @@ DROP PROCEDURE p1; DROP TABLE t1,t2,t3,t4,t5; --echo # +--echo # MDEV-19421: Embedding inner joins +--echo # + +create table t1 (a int); +insert into t1 values (7), (5), (3); +create table s1 (b int); +insert into s1 values (7), (5), (3); +create table t2 (a int); +insert into t2 values (5), (1), (7); +create table s2 (b int); +insert into s2 values (5), (1), (7); +create table t3 (a int); +insert into t3 values (2), (7), (3); +create table t4 (a int); +insert into t4 values (4), (7), (9), (5); + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a +from t1 join t2 join t3 on t2.a=t3.a on t1.a=t2.a; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a +from t1 join t2 left join t3 on t2.a=t3.a on t1.a=t2.a; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a +from t1 join t2 right join t3 on t2.a=t3.a on t1.a=t3.a; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a +from t1 join t2 join t3 using(a) using(a); +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a +from t1 join t2 left join t3 using(a) using(a); +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a +from t1 join t2 right join t3 using(a) using(a); +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a +from t1 join t2 join t3 on t2.a=t3.a; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a +from t1 join t2 left join t3 on t2.a=t3.a; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a +from t1 join t2 right join t3 on t2.a=t3.a; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a +from t1 join t2 join t3 on t1.a=t3.a; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a +from t1 join t2 left join t3 on t1.a=t3.a; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a +from t1 join t2 right join t3 on t1.a=t3.a; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a +from t1 join (t2 join t3 on t2.a=t3.a); +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a +from t1 join (t2 left join t3 on t2.a=t3.a); +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a +from t1 join (t2 right join t3 on t2.a=t3.a); +eval explain extended $q; +eval $q; + +let $q= +select * +from s1 join t2 join t3 using(a); +eval explain extended $q; +eval $q; + +let $q= +select * +from s1 join t2 left join t3 using(a); +eval explain extended $q; +eval $q; + +let $q= +select * +from s1 join t2 right join t3 using(a); +eval explain extended $q; +eval $q; + +let $q= +select s1.b, t2.a as t2_a, t3.a as t3_a +from s1 join t2 join t3 using(a); +eval explain extended $q; +eval $q; + +let $q= +select s1.b, t2.a as t2_a, t3.a as t3_a +from s1 join t2 left join t3 using(a); +eval explain extended $q; +eval $q; + +let $q= +select s1.b, t2.a as t2_a, t3.a as t3_a +from s1 join t2 right join t3 using(a); +eval explain extended $q; +eval $q; + +let $q= +select s1.b, t2.a as t2_a, t3.a as t3_a +from (s1 join t2) right join t3 using(a); +eval explain extended $q; +eval $q; + +let $q= +select * +from s1 join t2 natural join t3; +eval explain extended $q; +eval $q; + +let $q= +select * +from s1 join t2 natural left join t3; +eval explain extended $q; +eval $q; + +let $q= +select * +from s1 join t2 natural right join t3; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a +from t1 join t2 join t3; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a +from t1 join t2 join t3 +where t1.a=t2.a and t2.a=t3.a; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from t1 join t2 join t3 join t4 on t3.a=t4.a on t2.a=t3.a; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from t1 join t2 left join t3 join t4 on t3.a=t4.a on t2.a=t3.a; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from t1 join t2 left join t3 left join t4 on t3.a=t4.a on t2.a=t3.a; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from t1 join t2 left join t3 right join t4 on t3.a=t4.a on t2.a=t3.a; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from t1 join t2 right join t3 join t4 on t3.a=t4.a on t2.a=t3.a; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from t1 join t2 right join t3 left join t4 on t3.a=t4.a on t2.a=t3.a; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from t1 join t2 right join t3 right join t4 on t3.a=t4.a on t2.a=t3.a; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from t1 join t2 join t3 join t4 on t3.a=t4.a; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from t1 join t2 join t3 left join t4 on t3.a=t4.a; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from t1 join t2 join t3 right join t4 on t3.a=t4.a; +eval explain extended $q; +eval $q; + +let $q= +select s1.b as s1_b, s2.b as s2_b, t3.a as t3_a, t4.a as t4_a +from s1 join s2 join t3 join t4 using(a); +eval explain extended $q; +eval $q; + +let $q= +select s1.b as s1_b, s2.b as s2_b, t3.a as t3_a, t4.a as t4_a +from s1 join s2 join t3 left join t4 using(a); +eval explain extended $q; +eval $q; + +let $q= +select s1.b as s1_b, s2.b as s2_b, t3.a as t3_a, t4.a as t4_a +from s1 join s2 join t3 right join t4 using(a); +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from t1 join t2 join t3 on t2.a=t3.a join t4; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from t1 join t2 left join t3 on t2.a=t3.a join t4; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from t1 join t2 right join t3 on t2.a=t3.a join t4; +eval explain extended $q; +eval $q; + +let $q= +select s1.b as s1_b, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from s1 join t2 join t3 using(a) join t4; +eval explain extended $q; +eval $q; + +let $q= +select s1.b as s1_b, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from s1 join t2 left join t3 using(a) join t4; +eval explain extended $q; +eval $q; + +let $q= +select s1.b as s1_b, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from s1 join t2 right join t3 using(a) join t4; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from t1 join t2 on t1.a=t2.a join t3 join t4 on t3.a=t4.a; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from t1 join t2 on t1.a=t2.a join t3 left join t4 on t3.a=t4.a; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from t1 join t2 on t1.a=t2.a join t3 right join t4 on t3.a=t4.a; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from t1 left join t2 on t1.a=t2.a join t3 join t4 on t3.a=t4.a; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from t1 left join t2 on t1.a=t2.a join t3 left join t4 on t3.a=t4.a; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from t1 left join t2 on t1.a=t2.a join t3 right join t4 on t3.a=t4.a; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from t1 right join t2 on t1.a=t2.a join t3 join t4 on t3.a=t4.a; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from t1 right join t2 on t1.a=t2.a join t3 left join t4 on t3.a=t4.a; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from t1 right join t2 on t1.a=t2.a join t3 right join t4 on t3.a=t4.a; +eval explain extended $q; +eval $q; + +let $q= +select s1.b as s1_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from s1 join t1 left join t2 on s1.b=t2.a join t3 join t4 on t4.a=s1.b; +eval explain extended $q; +eval $q; + +let $q= +select s1.b as s1_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from s1 join t1 left join t2 on s1.b=t2.a join t3 left join t4 on t4.a=s1.b; +eval explain extended $q; +eval $q; + +let $q= +select s1.b as s1_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from s1 join t1 left join t2 on s1.b=t2.a join t3 right join t4 on t4.a=s1.b; +eval explain extended $q; +eval $q; + +let $q= +select s1.b as s1_b, s2.b as s2_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a +from s1 join s2 on s1.b=s2.b join t1 right join t2 on t1.a=t2.a join t3; +eval explain extended $q; +eval $q; + +let $q= +select s1.b as s1_b, s2.b as s2_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a +from s1 left join s2 on s1.b=s2.b join t1 right join t2 on t1.a=t2.a join t3; +eval explain extended $q; +eval $q; + +let $q= +select s1.b as s1_b, s2.b as s2_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a +from s1 right join s2 on s1.b=s2.b join t1 right join t2 on t1.a=t2.a join t3; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from t1 join t2 right join t3 right join t4 on t3.a=t4.a on t2.a=t3.a; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from (t1 join t2) right join t3 right join t4 on t3.a=t4.a on t2.a=t3.a; +eval explain extended $q; +eval $q; + +let $q= +select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a +from (t1, t2) right join t3 right join t4 on t3.a=t4.a on t2.a=t3.a; +eval explain extended $q; +eval $q; + +drop table t1,t2,t3,t4,s1,s2; + +--echo # --echo # End of MariaDB 5.5 tests --echo # diff --git a/mysql-test/t/join_outer_innodb.test b/mysql-test/t/join_outer_innodb.test index 539d85a8b11..365c78183eb 100644 --- a/mysql-test/t/join_outer_innodb.test +++ b/mysql-test/t/join_outer_innodb.test @@ -358,7 +358,7 @@ drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16; drop table if exists t1,t2,t3; create table t2(a int,unique key (a)) engine=innodb; create table t3(b int) engine=innodb; -create table t1(a int,b int)engine=innodb; +create table t1(c int,b int)engine=innodb; set @mdev4270_opl= @@optimizer_prune_level; set @mdev4270_osd= @@optimizer_search_depth; diff --git a/mysql-test/t/plugin.test b/mysql-test/t/plugin.test index 68c4d5afd64..956edcc804a 100644 --- a/mysql-test/t/plugin.test +++ b/mysql-test/t/plugin.test @@ -252,6 +252,21 @@ select plugin_name from information_schema.plugins where plugin_library like 'ha uninstall soname 'ha_example'; select plugin_name from information_schema.plugins where plugin_library like 'ha_example%'; +# +# +# +set names utf8; +select convert('admin𝌆' using utf8); +--error ER_UDF_NO_PATHS +install plugin foo soname 'admin𝌆'; + +# +# Bug#27302459: EMPTY VALUE IN MYSQL.PLUGIN TABLE CAUSES SERVER TO EXIT ON STARTUP +# +insert mysql.plugin values (); +source include/restart_mysqld.inc; +delete from mysql.plugin where name = ''; + --echo # --echo # MDEV-5309 - RENAME TABLE does not check for existence of the table's diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index c8fc3e3177e..6d6d8274651 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -3875,6 +3875,83 @@ FROM FROM t1 A, (SELECT @cnt := 0) C) T ) X; drop table t1; + +--echo # +--echo # MDEV-17042: prepared statement does not return error with +--echo # SQL_MODE STRICT_TRANS_TABLES. (Part 1) +--echo # + +set @save_sql_mode=@@sql_mode; +set sql_mode='STRICT_ALL_TABLES'; + +CREATE TABLE t1 (id int, count int); +insert into t1 values (1,1),(0,2); +--error ER_TRUNCATED_WRONG_VALUE +update t1 set count = count + 1 where id = '1bad'; + +prepare stmt from "update t1 set count = count + 1 where id = '1bad'"; +--error ER_TRUNCATED_WRONG_VALUE +execute stmt; +deallocate prepare stmt; + +prepare stmt from 'update t1 set count = count + 1 where id = ?'; +set @a = '1bad'; +--error ER_TRUNCATED_WRONG_VALUE +execute stmt using @a; +deallocate prepare stmt; +drop table t1; + +CREATE TABLE t1 (id decimal(10,5), count int); +insert into t1 values (1,1),(0,2); +--error ER_TRUNCATED_WRONG_VALUE +update t1 set count = count + 1 where id = '1bad'; + +prepare stmt from "update t1 set count = count + 1 where id = '1bad'"; +--error ER_TRUNCATED_WRONG_VALUE +execute stmt; +deallocate prepare stmt; + +prepare stmt from 'update t1 set count = count + 1 where id = ?'; +set @a = '1bad'; +--error ER_TRUNCATED_WRONG_VALUE +execute stmt using @a; +deallocate prepare stmt; +drop table t1; + +CREATE TABLE t1 (id double, count int); +insert into t1 values (1,1),(0,2); +--error ER_TRUNCATED_WRONG_VALUE +update t1 set count = count + 1 where id = '1bad'; + +prepare stmt from "update t1 set count = count + 1 where id = '1bad'"; +--error ER_TRUNCATED_WRONG_VALUE +execute stmt; +deallocate prepare stmt; + +prepare stmt from 'update t1 set count = count + 1 where id = ?'; +set @a = '1bad'; +--error ER_TRUNCATED_WRONG_VALUE +execute stmt using @a; +deallocate prepare stmt; +drop table t1; + +CREATE TABLE t1 (id date, count int); +insert into t1 values ("2019-06-11",1),("2019-06-12",2); +--error ER_TRUNCATED_WRONG_VALUE +update t1 set count = count + 1 where id = '1bad'; + +prepare stmt from "update t1 set count = count + 1 where id = '1bad'"; +--error ER_TRUNCATED_WRONG_VALUE +execute stmt; +deallocate prepare stmt; + +prepare stmt from 'update t1 set count = count + 1 where id = ?'; +set @a = '1bad'; +--error ER_TRUNCATED_WRONG_VALUE +execute stmt using @a; +deallocate prepare stmt; +drop table t1; +set sql_mode=@save_sql_mode; --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/ps_innodb.test b/mysql-test/t/ps_innodb.test new file mode 100644 index 00000000000..6f56af35271 --- /dev/null +++ b/mysql-test/t/ps_innodb.test @@ -0,0 +1,80 @@ +--source include/have_innodb.inc + +--echo # +--echo # MDEV-17042: prepared statement does not return error with +--echo # SQL_MODE STRICT_TRANS_TABLES. (Part 2) +--echo # + +set @save_sql_mode=@@sql_mode; +set sql_mode='STRICT_TRANS_TABLES'; + +CREATE TABLE t1 (id int, count int) engine=innodb; +insert into t1 values (1,1),(0,2); +--error ER_TRUNCATED_WRONG_VALUE +update t1 set count = count + 1 where id = '1bad'; + +prepare stmt from "update t1 set count = count + 1 where id = '1bad'"; +--error ER_TRUNCATED_WRONG_VALUE +execute stmt; +deallocate prepare stmt; + +prepare stmt from 'update t1 set count = count + 1 where id = ?'; +set @a = '1bad'; +--error ER_TRUNCATED_WRONG_VALUE +execute stmt using @a; +deallocate prepare stmt; +drop table t1; + +CREATE TABLE t1 (id decimal(10,5), count int) engine=innodb; +insert into t1 values (1,1),(0,2); +--error ER_TRUNCATED_WRONG_VALUE +update t1 set count = count + 1 where id = '1bad'; + +prepare stmt from "update t1 set count = count + 1 where id = '1bad'"; +--error ER_TRUNCATED_WRONG_VALUE +execute stmt; +deallocate prepare stmt; + +prepare stmt from 'update t1 set count = count + 1 where id = ?'; +set @a = '1bad'; +--error ER_TRUNCATED_WRONG_VALUE +execute stmt using @a; +deallocate prepare stmt; +drop table t1; + +CREATE TABLE t1 (id double, count int) engine=innodb; +insert into t1 values (1,1),(0,2); +--error ER_TRUNCATED_WRONG_VALUE +update t1 set count = count + 1 where id = '1bad'; + +prepare stmt from "update t1 set count = count + 1 where id = '1bad'"; +--error ER_TRUNCATED_WRONG_VALUE +execute stmt; +deallocate prepare stmt; + +prepare stmt from 'update t1 set count = count + 1 where id = ?'; +set @a = '1bad'; +--error ER_TRUNCATED_WRONG_VALUE +execute stmt using @a; +deallocate prepare stmt; +drop table t1; + +CREATE TABLE t1 (id date, count int) engine=innodb; +insert into t1 values ("2019-06-11",1),("2019-06-12",2); +--error ER_TRUNCATED_WRONG_VALUE +update t1 set count = count + 1 where id = '1bad'; + +prepare stmt from "update t1 set count = count + 1 where id = '1bad'"; +--error ER_TRUNCATED_WRONG_VALUE +execute stmt; +deallocate prepare stmt; + +prepare stmt from 'update t1 set count = count + 1 where id = ?'; +set @a = '1bad'; +--error ER_TRUNCATED_WRONG_VALUE +execute stmt using @a; +deallocate prepare stmt; +drop table t1; +set sql_mode=@save_sql_mode; + +--echo # End of 5.5 tests diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index a4c4c21610e..871f5ee9622 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -6113,6 +6113,30 @@ explain select * from t1 where (select max(b) from t2) = 10 and t1.a > 3; drop table t1,t2; + +--echo # +--echo # MDEV-19429: Wrong query result with EXISTS and LIMIT 0 +--echo # +create table t10 (a int); +insert into t10 values (1),(2),(3); +create table t12 (a int); +insert into t12 values (1),(2),(3); +select * from t10 where exists (select * from t12 order by a limit 0); +explain select * from t10 where exists (select * from t12 order by a limit 0); + +prepare stmt1 from "select * from t10 where exists (select * from t12 order by a limit ?)"; + +set @l=1; +execute stmt1 using @l; +set @l=2; +execute stmt1 using @l; +set @l=0; +execute stmt1 using @l; + +deallocate prepare stmt1; + +drop table t10, t12; + --echo End of 5.5 tests --echo # End of 10.0 tests diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 2d1266dd17a..f7c9ffbc99b 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -5691,6 +5691,26 @@ t46, t47, t48, t49, t50, t51, t52, t53, t54, t55, t56, t57, t58, t59,t60; drop view v60; +--echo # +--echo # MDEV-15572: view.test, server crash with --big-tables=1 +--echo # + +set @save_big_tables=@@big_tables; +set big_tables=ON; +CREATE TABLE t1 ( f1 int , f2 int , f3 int , f4 int); +CREATE TABLE t2 ( f1 int , f2 int , f3 int , f4 int); + +CREATE VIEW v1 AS + SELECT t2.f1, t1.f2, t2.f3, t2.f4 FROM (t1 JOIN t2); + +--error ER_VIEW_MULTIUPDATE +REPLACE INTO v1 (f1, f2, f3, f4) + SELECT f1, f2, f3, f4 FROM t1; + +drop view v1; +drop table t1, t2; +set big_tables=@save_big_tables; + --echo # ----------------------------------------------------------------- --echo # -- End of 5.5 tests. --echo # ----------------------------------------------------------------- |