~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
#
2
# Test of update and delete with limit
3
#
4
5
--disable_warnings
6
drop table if exists t1;
7
--enable_warnings
8
9
create table t1 (a int not null default 0 primary key, b int not null default 0);
10
insert into t1 () values ();		# Testing default values
11
insert into t1 values (1,1),(2,1),(3,1);
12
update t1 set a=4 where b=1 limit 1;
13
select * from t1;
14
update t1 set b=2 where b=1 limit 2;
496.1.2 by Paul McCullagh
Changes to .test files to run both PBXT and InnoDB
15
--sorted_result
1 by brian
clean slate
16
select * from t1;
17
update t1 set b=4 where b=1;
496.1.2 by Paul McCullagh
Changes to .test files to run both PBXT and InnoDB
18
--sorted_result
1 by brian
clean slate
19
select * from t1;
20
delete from t1 where b=2 limit 1;
496.1.2 by Paul McCullagh
Changes to .test files to run both PBXT and InnoDB
21
--sorted_result
1 by brian
clean slate
22
select * from t1;
23
delete from t1 limit 1;
496.1.2 by Paul McCullagh
Changes to .test files to run both PBXT and InnoDB
24
--sorted_result
1 by brian
clean slate
25
select * from t1;
26
drop table t1;
27
28
create table t1 (i int);
29
insert into t1 (i) values(1),(1),(1);
30
delete from t1 limit 1;
31
update t1 set i=2 limit 1;
32
delete from t1 limit 0;
33
update t1 set i=3 limit 0;
496.1.2 by Paul McCullagh
Changes to .test files to run both PBXT and InnoDB
34
--sorted_result
1 by brian
clean slate
35
select * from t1;
36
drop table t1;
37
38
# LIMIT 0
39
40
select 0 limit 0;
41
42
#
43
# Test with DELETE, ORDER BY and limit (bug #1024)
44
#
45
46
CREATE TABLE t1(id int auto_increment primary key, id2 int, index(id2)); 
47
INSERT INTO t1 (id2) values (0),(0),(0);
48
DELETE FROM t1 WHERE id=1;
49
INSERT INTO t1 SET id2=0;
50
SELECT * FROM t1; 
51
DELETE FROM t1 WHERE id2 = 0 ORDER BY id LIMIT 1; 
52
# should have deleted WHERE id=2 
53
SELECT * FROM t1; 
54
DELETE FROM t1 WHERE id2 = 0 ORDER BY id desc LIMIT 1; 
55
SELECT * FROM t1;
56
DROP TABLE t1;
57
58
#
59
# Bug #21787: COUNT(*) + ORDER BY + LIMIT returns wrong result
60
#
61
create table t1 (a int);
62
insert into t1 values (1),(2),(3),(4),(5),(6),(7);
63
explain select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
64
select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
65
explain select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
66
select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
67
drop table t1;
68
# End of 4.1 tests
69
70
--echo End of 5.0 tests