~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/limit.test

  • Committer: Patrick Galbraith
  • Date: 2008-07-24 16:57:40 UTC
  • mto: (202.2.4 rename-mysql-to-drizzle)
  • mto: This revision was merged to the branch mainline in revision 212.
  • Revision ID: patg@ishvara-20080724165740-x58yw6zs6d9o17lf
Most everything working with client rename
mysqlslap test still fails... can't connect to the server

Show diffs side-by-side

added added

removed removed

Lines of Context:
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;
15
 
--sorted_result
16
 
select * from t1;
17
 
update t1 set b=4 where b=1;
18
 
--sorted_result
19
 
select * from t1;
20
 
delete from t1 where b=2 limit 1;
21
 
--sorted_result
22
 
select * from t1;
23
 
delete from t1 limit 1;
24
 
--sorted_result
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;
34
 
--sorted_result
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