summaryrefslogtreecommitdiff
path: root/mysql-test/t/update.test
diff options
context:
space:
mode:
authormonty@narttu.mysql.fi <>2003-05-19 16:35:49 +0300
committermonty@narttu.mysql.fi <>2003-05-19 16:35:49 +0300
commitdd2b7918cdd5e0e643cff0305542ccd4aa8f1b6b (patch)
tree6025913cf3d482ba0783bf3420f7341c10cd574a /mysql-test/t/update.test
parent524878e9358706ffb5908677c746a9060c66ad32 (diff)
parentfc0df599dc72408419e80a5f1d3e07dc5f0fec88 (diff)
downloadmariadb-git-dd2b7918cdd5e0e643cff0305542ccd4aa8f1b6b.tar.gz
Merge with 4.0.13
Diffstat (limited to 'mysql-test/t/update.test')
-rw-r--r--mysql-test/t/update.test46
1 files changed, 41 insertions, 5 deletions
diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test
index 6a7eac41a96..485af981fb4 100644
--- a/mysql-test/t/update.test
+++ b/mysql-test/t/update.test
@@ -84,12 +84,48 @@ drop table t1;
# Test of ORDER BY
#
-create table t1 (a int not null, b int not null);
-insert into t1 values (1,1),(1,2),(1,3);
-update t1 set b=4 where a=1 order by b asc limit 1;
-update t1 set b=4 where a=1 order by b desc limit 1;
+create table t1 (a int not null, b int not null, key (a));
+insert into t1 values (1,1),(1,2),(1,3),(3,1),(3,2),(3,3),(3,1),(3,2),(3,3),(2,1),(2,2),(2,3);
+SET @tmp=0;
+update t1 set b=(@tmp:=@tmp+1) order by a;
+update t1 set b=99 where a=1 order by b asc limit 1;
+select * from t1 order by a,b;
+update t1 set b=100 where a=1 order by b desc limit 2;
+update t1 set a=a+10+b where a=1 order by b;
+select * from t1 order by a,b;
create table t2 (a int not null, b int not null);
insert into t2 values (1,1),(1,2),(1,3);
-select * from t1;
update t1 set b=(select distinct 1 from (select * from t2) a);
drop table t1,t2;
+
+#
+# Test with limit (Bug #393)
+#
+
+CREATE TABLE t1 (
+ `id_param` smallint(3) unsigned NOT NULL default '0',
+ `nom_option` char(40) NOT NULL default '',
+ `valid` tinyint(1) NOT NULL default '0',
+ KEY `id_param` (`id_param`,`nom_option`)
+ ) TYPE=MyISAM;
+
+INSERT INTO t1 (id_param,nom_option,valid) VALUES (185,'600x1200',1);
+
+UPDATE t1 SET nom_option='test' WHERE id_param=185 AND nom_option='600x1200' AND valid=1 LIMIT 1;
+select * from t1;
+drop table t1;
+
+#
+# Multi table update test from bugs
+#
+
+create table t1 (F1 VARCHAR(30), F2 VARCHAR(30), F3 VARCHAR(30), cnt int, groupid int, KEY groupid_index (groupid));
+
+insert into t1 (F1,F2,F3,cnt,groupid) values ('0','0','0',1,6),
+('0','1','2',1,5), ('0','2','0',1,3), ('1','0','1',1,2),
+('1','2','1',1,1), ('1','2','2',1,1), ('2','0','1',2,4),
+('2','2','0',1,7);
+
+delete from t1 using t1 m1,t1 m2 where m1.groupid=m2.groupid and (m1.cnt < m2.cnt or m1.cnt=m2.cnt and m1.F3>m2.F3);
+select * from t1;
+drop table t1;