|
|
|
@ -770,4 +770,75 @@ c abc ab |
|
|
|
d ab ab |
|
|
|
e abc abc |
|
|
|
DROP TABLE t1; |
|
|
|
create table t1 (a int not null primary key, b int not null) engine=ndb; |
|
|
|
create table t2 (a int not null primary key, b int not null) engine=ndb; |
|
|
|
insert into t1 values (1,10), (2,20), (3,30); |
|
|
|
insert into t2 values (1,10), (2,20), (3,30); |
|
|
|
select * from t1 order by a; |
|
|
|
a b |
|
|
|
1 10 |
|
|
|
2 20 |
|
|
|
3 30 |
|
|
|
delete from t1 where a > 0 order by a desc limit 1; |
|
|
|
select * from t1 order by a; |
|
|
|
a b |
|
|
|
1 10 |
|
|
|
2 20 |
|
|
|
delete from t1,t2 using t1,t2 where t1.a = t2.a; |
|
|
|
select * from t2 order by a; |
|
|
|
a b |
|
|
|
3 30 |
|
|
|
drop table t1,t2; |
|
|
|
create table t1 (a int not null primary key, b int not null) engine=ndb; |
|
|
|
insert into t1 values (1,10), (2,20), (3,30); |
|
|
|
insert into t1 set a=1, b=100; |
|
|
|
ERROR 23000: Duplicate entry '1' for key 1 |
|
|
|
insert ignore into t1 set a=1, b=100; |
|
|
|
select * from t1 order by a; |
|
|
|
a b |
|
|
|
1 10 |
|
|
|
2 20 |
|
|
|
3 30 |
|
|
|
insert into t1 set a=1, b=1000 on duplicate key update b=b+1; |
|
|
|
select * from t1 order by a; |
|
|
|
a b |
|
|
|
1 11 |
|
|
|
2 20 |
|
|
|
3 30 |
|
|
|
drop table t1; |
|
|
|
create table t1 (a int not null primary key, b int not null) engine=ndb; |
|
|
|
create table t2 (c int not null primary key, d int not null) engine=ndb; |
|
|
|
insert into t1 values (1,10), (2,10), (3,30), (4, 30); |
|
|
|
insert into t2 values (1,10), (2,10), (3,30), (4, 30); |
|
|
|
update t1 set a = 1 where a = 3; |
|
|
|
ERROR 23000: Duplicate entry '1' for key 1 |
|
|
|
select * from t1 order by a; |
|
|
|
a b |
|
|
|
1 10 |
|
|
|
2 10 |
|
|
|
3 30 |
|
|
|
4 30 |
|
|
|
update t1 set b = 1 where a > 1 order by a desc limit 1; |
|
|
|
select * from t1 order by a; |
|
|
|
a b |
|
|
|
1 10 |
|
|
|
2 10 |
|
|
|
3 30 |
|
|
|
4 1 |
|
|
|
update t1,t2 set a = 1, c = 1 where a = 3 and c = 3; |
|
|
|
ERROR 23000: Duplicate entry '1' for key 1 |
|
|
|
select * from t1 order by a; |
|
|
|
a b |
|
|
|
1 10 |
|
|
|
2 10 |
|
|
|
3 30 |
|
|
|
4 1 |
|
|
|
update ignore t1,t2 set a = 1, c = 1 where a = 3 and c = 3; |
|
|
|
select * from t1 order by a; |
|
|
|
a b |
|
|
|
1 10 |
|
|
|
2 10 |
|
|
|
3 30 |
|
|
|
4 1 |
|
|
|
drop table t1,t2; |
|
|
|
End of 5.0 tests |