~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
drop table if exists t1,t2,t3,t11,t12;
396 by Brian Aker
Cleanup tiny and small int.
2
CREATE TABLE t1 (a int, b int);
1 by brian
clean slate
3
INSERT INTO t1 VALUES (1,1);
1008.1.2 by Brian Aker
Removed old DELAYED keyword from parser (plus cleaned up tests). Also
4
INSERT INTO t1 VALUES (1,2);
1 by brian
clean slate
5
INSERT INTO t1 VALUES (1,3);
6
DELETE from t1 where a=1 limit 1;
1008.1.2 by Brian Aker
Removed old DELAYED keyword from parser (plus cleaned up tests). Also
7
DELETE from t1 where a=1;
1 by brian
clean slate
8
INSERT INTO t1 VALUES (1,1);
9
DELETE from t1;
10
INSERT INTO t1 VALUES (1,2);
11
DELETE from t1;
12
INSERT INTO t1 VALUES (1,2);
13
SET AUTOCOMMIT=0;
14
DELETE from t1;
15
SET AUTOCOMMIT=1;
16
drop table t1;
17
create table t1 (
18
a bigint not null,
19
b bigint not null default 0,
20
c bigint not null default 0,
21
d bigint not null default 0,
22
e bigint not null default 0,
23
f bigint not null default 0,
24
g bigint not null default 0,
25
h bigint not null default 0,
26
i bigint not null default 0,
27
j bigint not null default 0,
28
primary key (a,b,c,d,e,f,g,h,i,j));
29
insert into t1 (a) values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23);
30
delete from t1 where a=26;
31
drop table t1;
32
create table t1 (
33
a bigint not null,
34
b bigint not null default 0,
35
c bigint not null default 0,
36
d bigint not null default 0,
37
e bigint not null default 0,
38
f bigint not null default 0,
39
g bigint not null default 0,
40
h bigint not null default 0,
41
i bigint not null default 0,
42
j bigint not null default 0,
43
primary key (a,b,c,d,e,f,g,h,i,j));
44
insert into t1 (a) values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
45
delete from t1 where a=27;
46
drop table t1;
47
CREATE TABLE `t1` (
223 by Brian Aker
Cleanup int() work.
48
`i` int NOT NULL default '0',
49
`i2` int NOT NULL default '0',
1 by brian
clean slate
50
PRIMARY KEY  (`i`)
51
);
52
drop table t1;
1063.9.3 by Brian Aker
Partial fix for tests for tmp
53
CREATE TEMPORARY TABLE t1 (
1 by brian
clean slate
54
bool     char(0) default NULL,
1217 by Brian Aker
Removed bits of charset support from the parser.
55
not_null varchar(20) NOT NULL default '',
1 by brian
clean slate
56
misc     integer not null,
57
PRIMARY KEY  (not_null)
58
) ENGINE=MyISAM;
59
INSERT INTO t1 VALUES (NULL,'a',4), (NULL,'b',5), (NULL,'c',6), (NULL,'d',7);
60
select * from t1 where misc > 5 and bool is null;
61
bool	not_null	misc
62
NULL	c	6
63
NULL	d	7
64
delete   from t1 where misc > 5 and bool is null;
65
select * from t1 where misc > 5 and bool is null;
66
bool	not_null	misc
67
select count(*) from t1;
68
count(*)
69
2
70
delete from t1 where 1 > 2;
71
select count(*) from t1;
72
count(*)
73
2
74
delete from t1 where 3 > 2;
75
select count(*) from t1;
76
count(*)
77
0
78
drop table t1;
79
create table t11 (a int NOT NULL, b int, primary key (a));
80
create table t12 (a int NOT NULL, b int, primary key (a));
81
create table t2 (a int NOT NULL, b int, primary key (a));
82
insert into t11 values (0, 10),(1, 11),(2, 12);
83
insert into t12 values (33, 10),(0, 11),(2, 12);
84
insert into t2 values (1, 21),(2, 12),(3, 23);
85
select * from t11;
86
a	b
87
0	10
88
1	11
89
2	12
90
select * from t12;
91
a	b
201 by Brian Aker
Convert default engine to Innodb
92
0	11
93
2	12
1 by brian
clean slate
94
33	10
95
select * from t2;
96
a	b
97
1	21
98
2	12
99
3	23
1108.1.1 by Brian Aker
Remove multi-update from parser/tests.
100
select * from t11;
101
a	b
102
0	10
103
1	11
104
2	12
105
select * from t12;
106
a	b
107
0	11
108
2	12
109
33	10
110
select * from t11;
111
a	b
112
0	10
113
1	11
114
2	12
115
select * from t12;
116
a	b
117
0	11
118
2	12
119
33	10
1 by brian
clean slate
120
delete from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
121
ERROR 21000: Subquery returns more than 1 row
122
select * from t11;
123
a	b
124
0	10
125
1	11
126
2	12
127
delete ignore from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
128
Warnings:
129
Error	1242	Subquery returns more than 1 row
130
Error	1242	Subquery returns more than 1 row
131
select * from t11;
132
a	b
133
0	10
134
1	11
135
drop table t11, t12, t2;
136
create table t1 (a int, b int, unique key (a), key (b));
137
insert into t1 values (3, 3), (7, 7);
1108.1.1 by Brian Aker
Remove multi-update from parser/tests.
138
delete from t1 where a = 3;
1 by brian
clean slate
139
check table t1;
140
Table	Op	Msg_type	Msg_text
141
test.t1	check	status	OK
142
select * from t1;
143
a	b
144
7	7
145
drop table t1;
146
CREATE TABLE t1 ( a int PRIMARY KEY );
147
DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a;
148
INSERT INTO t1 VALUES (0),(1),(2);
149
DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a LIMIT 1;
150
SELECT * FROM t1;
151
a
152
0
153
2
154
DROP TABLE t1;
155
create table t1(f1 int primary key);
156
insert into t1 values (4),(3),(1),(2);
157
delete from t1 where (@a:= f1) order by f1 limit 1;
158
select @a;
159
@a
160
1
161
drop table t1;
162
CREATE TABLE t1 (
163
`date` date ,
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
164
`seq` int NOT NULL auto_increment,
1 by brian
clean slate
165
PRIMARY KEY  (`seq`),
166
KEY `seq` (`seq`),
167
KEY `date` (`date`)
168
);
896.5.1 by Jay Pipes
Removes the TIME column type and related time functions.
169
DELETE FROM t1 ORDER BY date ASC LIMIT 1;
1 by brian
clean slate
170
drop table t1;
171
End of 4.1 tests
172
CREATE TABLE t1 (a INT);
173
INSERT INTO t1 VALUES (1);
174
DELETE FROM t1 ORDER BY x;
175
ERROR 42S22: Unknown column 'x' in 'order clause'
176
DELETE FROM t1 ORDER BY t2.x;
177
ERROR 42S22: Unknown column 't2.x' in 'order clause'
178
DELETE FROM t1 ORDER BY (SELECT x);
179
ERROR 42S22: Unknown column 'x' in 'field list'
180
DROP TABLE t1;
181
CREATE TABLE t1 (
182
a INT
183
);
184
CREATE TABLE t2 (
185
a INT
186
);
187
CREATE DATABASE db1;
188
CREATE TABLE db1.t1 (
189
a INT
190
);
191
INSERT INTO db1.t1 (a) SELECT * FROM t1;
192
CREATE DATABASE db2;
193
CREATE TABLE db2.t1 (
194
a INT
195
);
196
INSERT INTO db2.t1 (a) SELECT * FROM t2;
197
SELECT * FROM t1;
198
a
199
DELETE FROM t1 alias USING t1 alias WHERE a = 2;
629.2.6 by Monty
Updated test output with new and improved error messages.
200
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'alias USING t1 alias WHERE a = 2' at line 1
1 by brian
clean slate
201
SELECT * FROM t1;
202
a
203
DROP TABLE t1, t2;
204
DROP DATABASE db1;
205
DROP DATABASE db2;
206
End of 5.0 tests
207
DROP DATABASE IF EXISTS db1;
208
DROP DATABASE IF EXISTS db2;
209
DROP DATABASE IF EXISTS db3;
210
DROP DATABASE IF EXISTS db4;
211
DROP TABLE IF EXISTS t1, t2;
212
USE test;
213
CREATE DATABASE db1;
214
CREATE DATABASE db2;
215
CREATE TABLE db1.t1 (a INT, b INT);
216
INSERT INTO db1.t1 VALUES (1,1),(2,2),(3,3);
217
CREATE TABLE db1.t2 AS SELECT * FROM db1.t1;
218
CREATE TABLE db2.t1 AS SELECT * FROM db1.t2;
219
CREATE TABLE db2.t2 AS SELECT * FROM db2.t1;
220
CREATE TABLE t1 AS SELECT * FROM db2.t2;
221
CREATE TABLE t2 AS SELECT * FROM t1;
1435.1.3 by Stewart Smith
fix delete test case so that it doesn't leave databases and tables lying around carelessly for somebody to trip down the stairs on.
222
DROP DATABASE db1;
223
DROP DATABASE db2;
224
DROP TABLE t1, t2;