~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/update.result

  • Committer: Stewart Smith
  • Date: 2008-11-21 16:06:07 UTC
  • mto: This revision was merged to the branch mainline in revision 593.
  • Revision ID: stewart@flamingspork.com-20081121160607-n6gdlt013spuo54r
remove mysql_frm_type
and fix engines to return correct value from delete_table when table doesn't exist.
(it should be ENOENT).

Also fix up some tests that manipulated frm files by hand. These tests are no longer valid and will need to be rewritten in the not too distant future.

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
place_id        shows
69
69
1       1
70
70
drop table t1;
71
 
CREATE TEMPORARY TABLE t1 (
 
71
CREATE TABLE t1 (
72
72
lfdnr int NOT NULL default '0',
73
73
ticket int NOT NULL default '0',
74
74
client varchar(255) NOT NULL default '',
141
141
insert into t2 values (1,1),(1,2),(1,3);
142
142
update t1 set b=(select distinct 1 from (select * from t2) a);
143
143
drop table t1,t2;
144
 
CREATE TEMPORARY TABLE t1 (
 
144
CREATE TABLE t1 (
145
145
`id_param` int NOT NULL default '0',
146
146
`nom_option` char(40) NOT NULL default '',
147
147
`valid` int NOT NULL default '0',
153
153
id_param        nom_option      valid
154
154
185     test    1
155
155
drop table t1;
 
156
create table t1 (F1 VARCHAR(30), F2 VARCHAR(30), F3 VARCHAR(30), cnt int, groupid int, KEY groupid_index (groupid));
 
157
insert into t1 (F1,F2,F3,cnt,groupid) values ('0','0','0',1,6),
 
158
('0','1','2',1,5), ('0','2','0',1,3), ('1','0','1',1,2),
 
159
('1','2','1',1,1), ('1','2','2',1,1), ('2','0','1',2,4),
 
160
('2','2','0',1,7);
 
161
delete from m1 using t1 m1,t1 m2 where m1.groupid=m2.groupid and (m1.cnt < m2.cnt or m1.cnt=m2.cnt and m1.F3>m2.F3);
 
162
select * from t1;
 
163
F1      F2      F3      cnt     groupid
 
164
0       0       0       1       6
 
165
0       1       2       1       5
 
166
0       2       0       1       3
 
167
1       0       1       1       2
 
168
1       2       1       1       1
 
169
2       0       1       2       4
 
170
2       2       0       1       7
 
171
drop table t1;
 
172
create table t1 (c1 int, c2 char(6), c3 int);
 
173
create table t2 (c1 int, c2 char(6));
 
174
insert into t1 values (1, "t1c2-1", 10), (2, "t1c2-2", 20);
 
175
update t1 left join t2 on t1.c1 = t2.c1 set t2.c2 = "t2c2-1";
 
176
update t1 left join t2 on t1.c1 = t2.c1 set t2.c2 = "t2c2-1" where t1.c3 = 10;
 
177
drop table t1, t2;
156
178
create table t1 (id int not null auto_increment primary key, id_str varchar(32));
157
179
insert into t1 (id_str) values ("test");
158
180
update t1 set id_str = concat(id_str, id) where id = last_insert_id();
167
189
a       b
168
190
0       2
169
191
drop table t1;
 
192
create table t1 (a int, b varchar(10), key b(b(5))) engine=myisam;
 
193
create table t2 (a int, b varchar(10)) engine=myisam;
 
194
insert into t1 values ( 1, 'abcd1e');
 
195
insert into t1 values ( 2, 'abcd2e');
 
196
insert into t2 values ( 1, 'abcd1e');
 
197
insert into t2 values ( 2, 'abcd2e');
 
198
analyze table t1,t2;
 
199
Table   Op      Msg_type        Msg_text
 
200
test.t1 analyze status  OK
 
201
test.t2 analyze status  OK
 
202
update t1, t2 set t1.a = t2.a where t2.b = t1.b;
 
203
show warnings;
 
204
Level   Code    Message
 
205
drop table t1, t2;
170
206
create table t1(f1 int, f2 int);
171
207
create table t2(f3 int, f4 int);
172
208
create index idx on t2(f3);
198
234
0
199
235
show status like 'handler_read%';
200
236
Variable_name   Value
201
 
Handler_read_first      #
202
 
Handler_read_key        #
203
 
Handler_read_next       #
204
 
Handler_read_prev       #
205
 
Handler_read_rnd        #
206
 
Handler_read_rnd_next   #
 
237
Handler_read_first      1
 
238
Handler_read_key        2
 
239
Handler_read_next       0
 
240
Handler_read_prev       0
 
241
Handler_read_rnd        0
 
242
Handler_read_rnd_next   0
207
243
flush status;
208
244
update t1 set a=9999 order by a limit 1;
209
245
update t1 set b=9999 order by a limit 1;
210
246
show status like 'handler_read%';
211
247
Variable_name   Value
212
 
Handler_read_first      #
213
 
Handler_read_key        #
214
 
Handler_read_next       #
215
 
Handler_read_prev       #
216
 
Handler_read_rnd        #
217
 
Handler_read_rnd_next   #
 
248
Handler_read_first      2
 
249
Handler_read_key        12
 
250
Handler_read_next       0
 
251
Handler_read_prev       0
 
252
Handler_read_rnd        2
 
253
Handler_read_rnd_next   18
218
254
flush status;
219
255
delete from t1 order by a limit 1;
220
256
show status like 'handler_read%';
221
257
Variable_name   Value
222
 
Handler_read_first      #
223
 
Handler_read_key        #
224
 
Handler_read_next       #
225
 
Handler_read_prev       #
226
 
Handler_read_rnd        #
227
 
Handler_read_rnd_next   #
 
258
Handler_read_first      1
 
259
Handler_read_key        6
 
260
Handler_read_next       0
 
261
Handler_read_prev       0
 
262
Handler_read_rnd        1
 
263
Handler_read_rnd_next   9
228
264
flush status;
229
265
delete from t1 order by a desc limit 1;
230
266
show status like 'handler_read%';
231
267
Variable_name   Value
232
 
Handler_read_first      #
233
 
Handler_read_key        #
234
 
Handler_read_next       #
235
 
Handler_read_prev       #
236
 
Handler_read_rnd        #
237
 
Handler_read_rnd_next   #
 
268
Handler_read_first      1
 
269
Handler_read_key        6
 
270
Handler_read_next       0
 
271
Handler_read_prev       0
 
272
Handler_read_rnd        1
 
273
Handler_read_rnd_next   8
238
274
alter table t1 disable keys;
239
275
Warnings:
240
276
Note    1031    Table storage engine for 't1' doesn't have this option
242
278
delete from t1 order by a limit 1;
243
279
show status like 'handler_read%';
244
280
Variable_name   Value
245
 
Handler_read_first      #
246
 
Handler_read_key        #
247
 
Handler_read_next       #
248
 
Handler_read_prev       #
249
 
Handler_read_rnd        #
250
 
Handler_read_rnd_next   #
 
281
Handler_read_first      1
 
282
Handler_read_key        6
 
283
Handler_read_next       0
 
284
Handler_read_prev       0
 
285
Handler_read_rnd        1
 
286
Handler_read_rnd_next   7
251
287
select * from t1;
252
288
a       b
253
289
0       0
266
302
22      3
267
303
23      3
268
304
drop table t1;
269
 
create table t1 (f1 date NULL);
270
 
insert into t1 values('2000-01-01'),(NULL);
 
305
create table t1 (f1 date not null);
 
306
insert into t1 values('2000-01-01'),('0000-00-00');
271
307
update t1 set f1='2002-02-02' where f1 is null;
272
308
select * from t1;
273
309
f1
274
310
2000-01-01
275
311
2002-02-02
276
312
drop table t1;
 
313
create table t1 (f1 int);
 
314
create table t2 (f2 int);
 
315
insert into t1 values(1),(2);
 
316
insert into t2 values(1),(1);
 
317
update t1,t2 set f1=3,f2=3 where f1=f2 and f1=1;
 
318
affected rows: 3
 
319
info: Rows matched: 3  Changed: 3  Warnings: 0
 
320
update t2 set f2=1;
 
321
update t1 set f1=1 where f1=3;
 
322
update t2,t1 set f1=3,f2=3 where f1=f2 and f1=1;
 
323
affected rows: 3
 
324
info: Rows matched: 3  Changed: 3  Warnings: 0
 
325
drop table t1,t2;
277
326
create table t1 (a int);
278
327
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
279
328
create table t2 (a int, filler1 char(200), filler2 char(200), key(a));
282
331
update t2 set a=3 where a=2;
283
332
show status like 'handler_read%';
284
333
Variable_name   Value
285
 
Handler_read_first      #
286
 
Handler_read_key        #
287
 
Handler_read_next       #
288
 
Handler_read_prev       #
289
 
Handler_read_rnd        #
290
 
Handler_read_rnd_next   #
 
334
Handler_read_first      0
 
335
Handler_read_key        6
 
336
Handler_read_next       1
 
337
Handler_read_prev       0
 
338
Handler_read_rnd        1
 
339
Handler_read_rnd_next   0
291
340
drop table t1, t2;
292
341
create table t1(f1 int, `*f2` int);
293
342
insert into t1 values (1,1);
300
349
CREATE TABLE t1 (
301
350
request_id int NOT NULL auto_increment,
302
351
user_id varchar(12) default NULL,
303
 
time_stamp datetime,
 
352
time_stamp datetime NOT NULL default '0000-00-00 00:00:00',
304
353
ip_address varchar(15) default NULL,
305
354
PRIMARY KEY (request_id),
306
355
KEY user_id_2 (user_id,time_stamp)
319
368
user_id
320
369
show status like '%Handler_read%';
321
370
Variable_name   Value
322
 
Handler_read_first      #
323
 
Handler_read_key        #
324
 
Handler_read_next       #
325
 
Handler_read_prev       #
326
 
Handler_read_rnd        #
327
 
Handler_read_rnd_next   #
 
371
Handler_read_first      0
 
372
Handler_read_key        2
 
373
Handler_read_next       0
 
374
Handler_read_prev       0
 
375
Handler_read_rnd        0
 
376
Handler_read_rnd_next   0
328
377
SELECT user_id FROM t1 WHERE request_id=999999999999999999999999999999;
329
378
user_id
330
379
show status like '%Handler_read%';
331
380
Variable_name   Value
332
 
Handler_read_first      #
333
 
Handler_read_key        #
334
 
Handler_read_next       #
335
 
Handler_read_prev       #
336
 
Handler_read_rnd        #
337
 
Handler_read_rnd_next   #
 
381
Handler_read_first      0
 
382
Handler_read_key        4
 
383
Handler_read_next       0
 
384
Handler_read_prev       0
 
385
Handler_read_rnd        0
 
386
Handler_read_rnd_next   0
338
387
UPDATE t1 SET user_id=null WHERE request_id=9999999999999;
339
388
show status like '%Handler_read%';
340
389
Variable_name   Value
341
 
Handler_read_first      #
342
 
Handler_read_key        #
343
 
Handler_read_next       #
344
 
Handler_read_prev       #
345
 
Handler_read_rnd        #
346
 
Handler_read_rnd_next   #
 
390
Handler_read_first      0
 
391
Handler_read_key        6
 
392
Handler_read_next       0
 
393
Handler_read_prev       0
 
394
Handler_read_rnd        0
 
395
Handler_read_rnd_next   0
347
396
UPDATE t1 SET user_id=null WHERE request_id=999999999999999999999999999999;
348
 
Warnings:
349
 
Warning 1264    Out of range value for column 'request_id' at row 1
350
 
Warning 1264    Out of range value for column 'request_id' at row 1
351
397
show status like '%Handler_read%';
352
398
Variable_name   Value
353
 
Handler_read_first      #
354
 
Handler_read_key        #
355
 
Handler_read_next       #
356
 
Handler_read_prev       #
357
 
Handler_read_rnd        #
358
 
Handler_read_rnd_next   #
 
399
Handler_read_first      0
 
400
Handler_read_key        6
 
401
Handler_read_next       0
 
402
Handler_read_prev       0
 
403
Handler_read_rnd        0
 
404
Handler_read_rnd_next   0
359
405
DROP TABLE t1;
360
406
CREATE TABLE t1 (
361
407
a int,
388
434
select count(*) from t1 join t2 on (t1.a=t2.a);
389
435
count(*)
390
436
64
 
437
update t1 join t2 on (t1.a=t2.a) set t1.id=t2.id;
 
438
affected rows: 0
 
439
info: Rows matched: 64  Changed: 0  Warnings: 0
391
440
insert into t2(a) select a from t2;
392
441
update t2 set a=id;
393
442
truncate t1;
395
444
select count(*) from t1 join t2 on (t1.a=t2.a);
396
445
count(*)
397
446
128
 
447
update t1 join t2 on (t1.a=t2.a) set t1.id=t2.id;
 
448
affected rows: 0
 
449
info: Rows matched: 128  Changed: 0  Warnings: 0
398
450
update t1 set a=1;
399
451
update t2 set a=1;
400
452
select count(*) from t1 join t2 on (t1.a=t2.a);
401
453
count(*)
402
454
16384
 
455
update t1 join t2 on (t1.a=t2.a) set t1.id=t2.id;
 
456
affected rows: 127
 
457
info: Rows matched: 128  Changed: 127  Warnings: 0
403
458
drop table t1,t2;
404
 
CREATE TABLE t1(col1 enum('a','b') NOT NULL, col2 enum('a','b') DEFAULT NULL, KEY col2 (col2));
405
 
UPDATE t1 SET col1 = "crash" WHERE col2 = now() ;
406
 
drop table t1;
407
459
End of 5.0 tests