summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <Sinisa@sinisa.nasamreza.org>2004-03-11 22:26:03 +0200
committerunknown <Sinisa@sinisa.nasamreza.org>2004-03-11 22:26:03 +0200
commite657a607be0634f808f844ba4724525b1631356f (patch)
treeb9575d14f120058dcaca50f6cb10c5f7f7e23d94 /mysql-test
parente3e4cb26fd3d3db57e38ad85f8e51198a951d3a1 (diff)
downloadmariadb-git-e657a607be0634f808f844ba4724525b1631356f.tar.gz
multi_update.result:
Test case for a #2996 bug fix multi_update.test: test case for a #2996 bug fix sql_select.cc: Fix for a bug #2996 involving multi-table updates over the const tables sql/sql_select.cc: Fix for a bug #2996 involving multi-table updates over the const tables mysql-test/t/multi_update.test: test case for a #2996 bug fix mysql-test/r/multi_update.result: Test case for a #2996 bug fix
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/multi_update.result14
-rw-r--r--mysql-test/t/multi_update.test14
2 files changed, 28 insertions, 0 deletions
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index 21035c8bc60..df24a1cfd58 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -386,3 +386,17 @@ SELECT * from t2;
a
1
DROP TABLE t1,t2;
+create table `t1` ( `p_id` int(10) unsigned NOT NULL auto_increment, `p_code` varchar(20) NOT NULL default '', `p_created` datetime NOT NULL default '0000-00-00 00:00:00', `p_active` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`p_id`) );
+create table `t2` ( `c2_id` int(10) unsigned NULL auto_increment, `c2_p_id` int(10) unsigned NOT NULL default '0', `c2_note` text NOT NULL, `c2_created` datetime NOT NULL default '0000-00-00 00:00:00', `c2_active` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`c2_id`), KEY `c2_p_id` (`c2_p_id`) );
+insert into t1 values (0,'A01-Comp',now(),1);
+insert into t1 values (0,'B01-Comp',now(),1);
+insert into t2 values (0,1,'A Note',now(),1);
+update t1 left join t2 on p_id = c2_p_id set c2_note = 'asdf-1' where p_id = 2;
+select * from t1;
+p_id p_code p_created p_active
+1 A01-Comp 2004-03-11 23:21:29 1
+2 B01-Comp 2004-03-11 23:21:29 1
+select * from t2;
+c2_id c2_p_id c2_note c2_created c2_active
+1 1 A Note 2004-03-11 23:21:29 1
+drop table t1, t2;
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
index 283637912a1..6ed340ad92b 100644
--- a/mysql-test/t/multi_update.test
+++ b/mysql-test/t/multi_update.test
@@ -325,3 +325,17 @@ DELETE t2 FROM t1 AS t2, t2 AS t1 where t1.a=t2.a and t1.a=2;
SELECT * from t1;
SELECT * from t2;
DROP TABLE t1,t2;
+
+#
+# Test update with const tables
+#
+
+create table `t1` ( `p_id` int(10) unsigned NOT NULL auto_increment, `p_code` varchar(20) NOT NULL default '', `p_created` datetime NOT NULL default '0000-00-00 00:00:00', `p_active` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`p_id`) );
+create table `t2` ( `c2_id` int(10) unsigned NULL auto_increment, `c2_p_id` int(10) unsigned NOT NULL default '0', `c2_note` text NOT NULL, `c2_created` datetime NOT NULL default '0000-00-00 00:00:00', `c2_active` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`c2_id`), KEY `c2_p_id` (`c2_p_id`) );
+insert into t1 values (0,'A01-Comp',now(),1);
+insert into t1 values (0,'B01-Comp',now(),1);
+insert into t2 values (0,1,'A Note',now(),1);
+update t1 left join t2 on p_id = c2_p_id set c2_note = 'asdf-1' where p_id = 2;
+select * from t1;
+select * from t2;
+drop table t1, t2;