diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2019-07-12 10:03:33 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2019-07-12 12:28:17 +0200 |
commit | 04d446d84f6de753d5daa72caee80cdc0f14c6ac (patch) | |
tree | a44dacbdb59348ec37a814eda3dcf6499735220c /mysql-test/t/ps.test | |
parent | 8997f20f12309d2660988f254415a343d6328835 (diff) | |
download | mariadb-git-bb-5.5-MDEV-17042.tar.gz |
MDEV-17042: prepared statement does not return error with SQL_MODE STRICT_TRANS_TABLES.bb-5.5-MDEV-17042
Use for parameters value conversion functions which issue warnings.
Diffstat (limited to 'mysql-test/t/ps.test')
-rw-r--r-- | mysql-test/t/ps.test | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index ea67e1074f9..b5d3416d1ca 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -3858,4 +3858,81 @@ 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 |