diff options
author | holyfoot/hf@hfmain.(none) <> | 2007-07-31 11:03:31 +0500 |
---|---|---|
committer | holyfoot/hf@hfmain.(none) <> | 2007-07-31 11:03:31 +0500 |
commit | 0ff0ed27320b9b4e32185403dc988c3aced02305 (patch) | |
tree | 1338ba998786c6a663f5e2022c65fba822fcb911 /mysql-test/t/insert_select.test | |
parent | e53a484ec9ccc1543651a3c892e61d1773997ca3 (diff) | |
parent | 288ab1aa4136ea5bd7957987e2849b969efe9b84 (diff) | |
download | mariadb-git-0ff0ed27320b9b4e32185403dc988c3aced02305.tar.gz |
Merge mysql.com:/home/hf/work/29717/my41-29717
into mysql.com:/home/hf/work/29717/my50-29717
Diffstat (limited to 'mysql-test/t/insert_select.test')
-rw-r--r-- | mysql-test/t/insert_select.test | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test index bf6dae96847..fcd07a21821 100644 --- a/mysql-test/t/insert_select.test +++ b/mysql-test/t/insert_select.test @@ -239,6 +239,34 @@ show status like 'Handler_read%'; DROP TABLE t1; +# +# Bug #29717 INSERT INTO SELECT inserts values even if SELECT statement itself returns empty +# + +CREATE TABLE t1 ( + f1 int(10) unsigned NOT NULL auto_increment PRIMARY KEY, + f2 varchar(100) NOT NULL default '' +); +CREATE TABLE t2 ( + f1 varchar(10) NOT NULL default '', + f2 char(3) NOT NULL default '', + PRIMARY KEY (`f1`), + KEY `k1` (`f2`, `f1`) +); + +INSERT INTO t1 values(NULL, ''); +INSERT INTO `t2` VALUES ('486878','WDT'),('486910','WDT'); +SELECT COUNT(*) FROM t1; + +SELECT min(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1; + +INSERT INTO t1 (f2) + SELECT min(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1; + +SELECT COUNT(*) FROM t1; +SELECT * FROM t1; +DROP TABLE t1, t2; + # End of 4.1 tests # |