~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/delete.result

  • Committer: Brian Aker
  • Date: 2009-03-05 07:54:39 UTC
  • mto: This revision was merged to the branch mainline in revision 911.
  • Revision ID: brian@tangent.org-20090305075439-ubkvoauwj5er551l
Remove some dead bits of string (and fix the semi_join test).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
drop table if exists t1,t2,t3,t11,t12;
2
2
CREATE TABLE t1 (a int, b int);
3
3
INSERT INTO t1 VALUES (1,1);
4
 
INSERT INTO t1 VALUES (1,2);
 
4
INSERT LOW_PRIORITY INTO t1 VALUES (1,2);
5
5
INSERT INTO t1 VALUES (1,3);
6
6
DELETE from t1 where a=1 limit 1;
7
 
DELETE from t1 where a=1;
 
7
DELETE LOW_PRIORITY from t1 where a=1;
8
8
INSERT INTO t1 VALUES (1,1);
9
9
DELETE from t1;
 
10
LOCK TABLE t1 write;
10
11
INSERT INTO t1 VALUES (1,2);
11
12
DELETE from t1;
 
13
UNLOCK TABLES;
12
14
INSERT INTO t1 VALUES (1,2);
13
15
SET AUTOCOMMIT=0;
14
16
DELETE from t1;
49
51
`i2` int NOT NULL default '0',
50
52
PRIMARY KEY  (`i`)
51
53
);
 
54
DELETE FROM t1 USING t1 WHERE post='1';
 
55
ERROR 42S22: Unknown column 'post' in 'where clause'
52
56
drop table t1;
53
 
CREATE TEMPORARY TABLE t1 (
 
57
CREATE TABLE t1 (
54
58
bool     char(0) default NULL,
55
 
not_null varchar(20) NOT NULL default '',
 
59
not_null varchar(20) binary NOT NULL default '',
56
60
misc     integer not null,
57
61
PRIMARY KEY  (not_null)
58
62
) ENGINE=MyISAM;
76
80
count(*)
77
81
0
78
82
drop table t1;
 
83
create table t1 (a int not null auto_increment primary key, b char(32));
 
84
insert into t1 (b) values ('apple'), ('apple');
 
85
select * from t1;
 
86
a       b
 
87
1       apple
 
88
2       apple
 
89
delete t1 from t1, t1 as t2 where t1.b = t2.b and t1.a > t2.a;
 
90
select * from t1;
 
91
a       b
 
92
1       apple
 
93
drop table t1;
79
94
create table t11 (a int NOT NULL, b int, primary key (a));
80
95
create table t12 (a int NOT NULL, b int, primary key (a));
81
96
create table t2 (a int NOT NULL, b int, primary key (a));
97
112
1       21
98
113
2       12
99
114
3       23
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
 
115
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
 
116
ERROR 21000: Subquery returns more than 1 row
 
117
select * from t11;
 
118
a       b
 
119
0       10
 
120
1       11
 
121
2       12
 
122
select * from t12;
 
123
a       b
 
124
0       11
 
125
2       12
 
126
33      10
 
127
delete ignore t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
 
128
Warnings:
 
129
Error   1242    Subquery returns more than 1 row
 
130
select * from t11;
 
131
a       b
 
132
0       10
 
133
1       11
 
134
select * from t12;
 
135
a       b
 
136
0       11
 
137
33      10
 
138
insert into t11 values (2, 12);
120
139
delete from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
121
140
ERROR 21000: Subquery returns more than 1 row
122
141
select * from t11;
135
154
drop table t11, t12, t2;
136
155
create table t1 (a int, b int, unique key (a), key (b));
137
156
insert into t1 values (3, 3), (7, 7);
138
 
delete from t1 where a = 3;
 
157
delete t1 from t1 where a = 3;
139
158
check table t1;
140
159
Table   Op      Msg_type        Msg_text
141
160
test.t1 check   status  OK
152
171
0
153
172
2
154
173
DROP TABLE t1;
 
174
create table t1 (a int);
 
175
delete `4.t1` from t1 as `4.t1` where `4.t1`.a = 5;
 
176
delete FROM `4.t1` USING t1 as `4.t1` where `4.t1`.a = 5;
 
177
drop table t1;
155
178
create table t1(f1 int primary key);
156
179
insert into t1 values (4),(3),(1),(2);
157
180
delete from t1 where (@a:= f1) order by f1 limit 1;
169
192
DELETE FROM t1 ORDER BY date ASC LIMIT 1;
170
193
drop table t1;
171
194
End of 4.1 tests
 
195
CREATE TABLE t1 (a int not null,b int not null);
 
196
CREATE TABLE t2 (a int not null, b int not null, primary key (a,b));
 
197
CREATE TABLE t3 (a int not null, b int not null, primary key (a,b));
 
198
insert into t1 values (1,1),(2,1),(1,3);
 
199
insert into t2 values (1,1),(2,2),(3,3);
 
200
insert into t3 values (1,1),(2,1),(1,3);
 
201
select * from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
 
202
a       b       a       b       a       b
 
203
1       1       1       1       1       1
 
204
2       1       2       2       2       1
 
205
1       3       1       1       1       3
 
206
explain select * from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
 
207
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
208
1       SIMPLE  t1      ALL     NULL    NULL    NULL    NULL    3       
 
209
1       SIMPLE  t2      ref     PRIMARY PRIMARY 4       test.t1.a       1       Using index
 
210
1       SIMPLE  t3      eq_ref  PRIMARY PRIMARY 8       test.t2.b,test.t1.b     1       Using index
 
211
delete t2.*,t3.* from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
 
212
select * from t3;
 
213
a       b
 
214
drop table t1,t2,t3;
172
215
CREATE TABLE t1 (a INT);
173
216
INSERT INTO t1 VALUES (1);
174
217
DELETE FROM t1 ORDER BY x;
194
237
a INT
195
238
);
196
239
INSERT INTO db2.t1 (a) SELECT * FROM t2;
 
240
DELETE FROM t1 alias USING t1, t2 alias WHERE t1.a = alias.a;
 
241
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, t2 alias WHERE t1.a = alias.a' at line 1
 
242
DELETE FROM alias USING t1, t2 alias WHERE t1.a = alias.a;
 
243
DELETE FROM t1, alias USING t1, t2 alias WHERE t1.a = alias.a;
 
244
DELETE FROM t1, t2 USING t1, t2 alias WHERE t1.a = alias.a;
 
245
ERROR 42S02: Unknown table 't2' in MULTI DELETE
 
246
DELETE FROM db1.t1 alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a;
 
247
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 db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a' at line 1
 
248
DELETE FROM alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a;
 
249
DELETE FROM db2.alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a;
 
250
ERROR 42S02: Unknown table 'alias' in MULTI DELETE
 
251
DELETE FROM t1 USING t1 WHERE a = 1;
197
252
SELECT * FROM t1;
198
253
a
199
254
DELETE FROM t1 alias USING t1 alias WHERE a = 2;
219
274
CREATE TABLE db2.t2 AS SELECT * FROM db2.t1;
220
275
CREATE TABLE t1 AS SELECT * FROM db2.t2;
221
276
CREATE TABLE t2 AS SELECT * FROM t1;
 
277
CREATE DATABASE db3;
 
278
USE db3;
 
279
DROP DATABASE db3;
 
280
SELECT * FROM t1;
 
281
ERROR 3D000: No database selected
 
282
DELETE a1,a2 FROM db1.t1, db2.t2;
 
283
ERROR 3D000: No database selected
 
284
DELETE a1,a2 FROM db1.t1, db2.t2;
 
285
ERROR 3D000: No database selected
 
286
DELETE a1,a2 FROM db1.t1 AS a1, db2.t2;
 
287
ERROR 3D000: No database selected
 
288
DELETE a1,a2 FROM db1.t1, db2.t2 AS a2;
 
289
ERROR 3D000: No database selected
 
290
DELETE a1,a2 FROM db3.t1 AS a1, db4.t2 AS a2;
 
291
ERROR 3D000: No database selected
 
292
DELETE a1,a2 FROM db3.t1 AS a1, db4.t2 AS a2;
 
293
ERROR 3D000: No database selected
 
294
DELETE FROM a1,a2 USING db1.t1, db2.t2;
 
295
ERROR 3D000: No database selected
 
296
DELETE FROM a1,a2 USING db1.t1, db2.t2;
 
297
ERROR 3D000: No database selected
 
298
DELETE FROM a1,a2 USING db1.t1 AS a1, db2.t2;
 
299
ERROR 3D000: No database selected
 
300
DELETE FROM a1,a2 USING db1.t1, db2.t2 AS a2;
 
301
ERROR 3D000: No database selected
 
302
DELETE FROM a1,a2 USING db3.t1 AS a1, db4.t2 AS a2;
 
303
ERROR 3D000: No database selected
 
304
DELETE FROM a1,a2 USING db3.t1 AS a1, db4.t2 AS a2;
 
305
ERROR 3D000: No database selected
 
306
DELETE a1 FROM db1.t1 AS a1, db2.t2 AS a1;
 
307
ERROR 3D000: No database selected
 
308
DELETE a1 FROM db1.a1, db2.t2 AS a1;
 
309
ERROR 3D000: No database selected
 
310
DELETE a1 FROM a1, db1.t1 AS a1;
 
311
ERROR 3D000: No database selected
 
312
DELETE t1 FROM db1.t1, db2.t1 AS a1;
 
313
ERROR 3D000: No database selected
 
314
DELETE t1 FROM db1.t1 AS a1, db2.t1 AS a2;
 
315
ERROR 3D000: No database selected
 
316
DELETE t1 FROM db1.t1, db2.t1;
 
317
ERROR 3D000: No database selected
 
318
USE test;
 
319
DELETE a1,a2 FROM db1.t1, db2.t2;
 
320
ERROR 42S02: Unknown table 'a1' in MULTI DELETE
 
321
DELETE a1,a2 FROM db1.t1, db2.t2;
 
322
ERROR 42S02: Unknown table 'a1' in MULTI DELETE
 
323
DELETE a1,a2 FROM db1.t1 AS a1, db2.t2;
 
324
ERROR 42S02: Unknown table 'a2' in MULTI DELETE
 
325
DELETE a1,a2 FROM db1.t1, db2.t2 AS a2;
 
326
ERROR 42S02: Unknown table 'a1' in MULTI DELETE
 
327
DELETE a1,a2 FROM db3.t1 AS a1, db4.t2 AS a2;
 
328
ERROR 42S02: Table 'db3.t1' doesn't exist
 
329
DELETE a1,a2 FROM db3.t1 AS a1, db4.t2 AS a2;
 
330
ERROR 42S02: Table 'db3.t1' doesn't exist
 
331
DELETE FROM a1,a2 USING db1.t1, db2.t2;
 
332
ERROR 42S02: Unknown table 'a1' in MULTI DELETE
 
333
DELETE FROM a1,a2 USING db1.t1, db2.t2;
 
334
ERROR 42S02: Unknown table 'a1' in MULTI DELETE
 
335
DELETE FROM a1,a2 USING db1.t1 AS a1, db2.t2;
 
336
ERROR 42S02: Unknown table 'a2' in MULTI DELETE
 
337
DELETE FROM a1,a2 USING db1.t1, db2.t2 AS a2;
 
338
ERROR 42S02: Unknown table 'a1' in MULTI DELETE
 
339
DELETE FROM a1,a2 USING db3.t1 AS a1, db4.t2 AS a2;
 
340
ERROR 42S02: Table 'db3.t1' doesn't exist
 
341
DELETE FROM a1,a2 USING db3.t1 AS a1, db4.t2 AS a2;
 
342
ERROR 42S02: Table 'db3.t1' doesn't exist
 
343
DELETE a1 FROM db1.t1 AS a1, db2.t2 AS a1;
 
344
ERROR 42000: Not unique table/alias: 'a1'
 
345
DELETE a1 FROM db1.a1, db2.t2 AS a1;
 
346
ERROR 42S02: Table 'db1.a1' doesn't exist
 
347
DELETE a1 FROM a1, db1.t1 AS a1;
 
348
ERROR 42000: Not unique table/alias: 'a1'
 
349
DELETE t1 FROM db1.t1, db2.t1 AS a1;
 
350
ERROR 42S02: Unknown table 't1' in MULTI DELETE
 
351
DELETE t1 FROM db1.t1 AS a1, db2.t1 AS a2;
 
352
ERROR 42S02: Unknown table 't1' in MULTI DELETE
 
353
DELETE t1 FROM db1.t1, db2.t1;
 
354
ERROR 42S02: Unknown table 't1' in MULTI DELETE
 
355
DELETE t1 FROM db1.t2 AS t1, db2.t2 AS t2 WHERE t2.a = 1 AND t1.a = t2.a;
 
356
SELECT ROW_COUNT();
 
357
ROW_COUNT()
 
358
1
 
359
DELETE a1, a2 FROM db2.t1 AS a1, t2 AS a2 WHERE a1.a = 2 AND a2.a = 2;
 
360
SELECT ROW_COUNT();
 
361
ROW_COUNT()
 
362
2
222
363
DROP DATABASE db1;
223
364
DROP DATABASE db2;
224
365
DROP TABLE t1, t2;