From 5454f676ff4cd8a2f6ec577e35746dd18b31478f Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 16 Dec 2003 17:55:34 -0400 Subject: fixed restoring of thd->count_cuted_fields in store_val_in_field (fixed #bug 2012) mysql-test/r/insert_select.result: added test case for bug #2012 mysql-test/t/insert_select.test: added test case for bug #2012 --- mysql-test/r/insert_select.result | 12 ++++++++++++ mysql-test/t/insert_select.test | 31 +++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result index c754085ccb3..2435e28d7fe 100644 --- a/mysql-test/r/insert_select.result +++ b/mysql-test/r/insert_select.result @@ -11,3 +11,15 @@ payoutID 19 20 22 +Month Type Field Count +2003-09-01 1 1 100 +2003-09-01 1 2 100 +2003-09-01 2 1 100 +2003-09-01 2 2 100 +2003-09-01 3 1 100 +NULL Field Count +NULL 1 100 +NULL 2 100 +No Field Count +0 1 100 +0 2 100 diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test index 17ecb2d5a1f..625f4755a79 100644 --- a/mysql-test/t/insert_select.test +++ b/mysql-test/t/insert_select.test @@ -10,3 +10,34 @@ insert into t2 (payoutID) SELECT DISTINCT payoutID FROM t1; insert into t2 (payoutID) SELECT payoutID+10 FROM t1; select * from t2; drop table t1,t2; + +# +# Another problem from Bug #2012 +# + +CREATE TABLE t1( + Month date NOT NULL, + Type tinyint(3) unsigned NOT NULL auto_increment, + Field int(10) unsigned NOT NULL, + Count int(10) unsigned NOT NULL, + UNIQUE KEY Month (Month,Type,Field) +); + +insert into t1 Values +(20030901, 1, 1, 100), +(20030901, 1, 2, 100), +(20030901, 2, 1, 100), +(20030901, 2, 2, 100), +(20030901, 3, 1, 100); + +select * from t1; + +Select null, Field, Count From t1 Where Month=20030901 and Type=2; + +create table t2(No int not null, Field int not null, Count int not null); + +insert into t2 Select null, Field, Count From t1 Where Month=20030901 and Type=2; + +select * from t2; + +drop table t1, t2; -- cgit v1.2.1