~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
################################################################################
2
#                                                                              #
3
# include/mix2.inc                                                             #
4
#                                                                              #
5
# This is a derivate of t/innodb.test and has to be maintained by MySQL        #
6
# guys only.                                                                   #
7
#                                                                              #
8
# Please, DO NOT create a toplevel testcase mix2_innodb.test, because          #
9
# innodb.test does already these tests.                                        #
10
#                                                                              #
11
# Variables which have to be set before calling this script:                   #
12
#    $engine_type -- Storage engine to be tested                               #
13
#    $other_engine_type -- storage engine <> $engine_type                      #
14
#    $other_engine_type1 -- storage engine <> $engine_type                     #
15
#                           storage engine <> $other_engine_type, if possible  #
16
#    $other_non_trans_engine_type -- storage engine <> $engine_type            #
17
#                           $other_non_trans_engine_type must be a non         #
18
#                           transactional storage engine                       #
19
#    $other_non_live_chks_engine_type                                          #
20
#                         -- storage engine <> $engine_type, if possible       #
21
#                            storage engine must not support live checksum     #
22
#    $other_live_chks_engine_type                                              #
23
#                         -- storage engine <> $engine_type, if possible       #
24
#                            storage engine must support live checksum         #
25
#         General Note: The $other_*_engine_type variables must point to all   #
26
#                       time available storage engines                         #
27
#                       2006-08 MySQL 5.1 MyISAM and MEMORY only               #
28
#    $test_transactions -- 0, skip transactional tests                         #
29
#                       -- 1, do not skip transactional tests                  #
30
#    $test_foreign_keys -- 0, skip foreign key tests                           #
31
#                       -- 1, do not skip foreign key tests                    #
32
#    $fulltext_query_unsupported -- 0, execute fulltext_query tests            #
33
#                                -- 1, skip fulltext query tests               #
34
#    $no_autoinc_update -- 0, skip tests where it is expected that an update   #
35
#                             does not update the internal auto-increment value#
36
#                       -- 1, do not skip these tests                          #
37
#    $no_spatial_key    -- 0, skip tests where it is expected that keys on     #
38
#                             spatial data type are not allowed                #
39
#                       -- 1, do not skip these tests                          #
40
#                                                                              #
41
# The comments/expectations refer to InnoDB.                                   #
42
# They might be not valid for other storage engines.                           #
43
#                                                                              #
44
#                                                                              #
45
# Last update:                                                                 #
46
# 2006-08-15 ML - introduce several $variables                                 #
47
#               - correct some storage engine assignments                      #
48
#               - minor improvements like correct wrong table after analyze    #
49
#               - let checksum testcase meet all table variants with/without   #
50
#                 live checksum feature exiting and/or enabled                 #
51
# 2006-07-26 ML create script by using t/innodb.test and introduce $variables  #
52
#                                                                              #
53
################################################################################
54
55
# Set the SESSION DEFAULT STORAGE ENGINE to a value <> storage engine
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
56
# to be tested. This must not affect any create $temp table statement, where
1 by brian
clean slate
57
# the storage engine is assigned explicitely,
58
eval SET SESSION STORAGE_ENGINE = $other_engine_type;
59
60
#
61
# Small basic test with ignore
62
#
63
64
--disable_warnings
65
drop table if exists t1,t2,t3,t4;
66
drop database if exists mysqltest;
67
--enable_warnings
68
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
69
eval create $temp table t1 (id int not null auto_increment, code int not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=$engine_type;
1 by brian
clean slate
70
71
insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt');
72
select id, code, name from t1 order by id;
73
74
update ignore t1 set id = 8, name = 'Sinisa' where id < 3;
75
select id, code, name from t1 order by id;
76
update ignore t1 set id = id + 10, name = 'Ralph' where id < 4;
77
select id, code, name from t1 order by id;
78
79
drop table t1;
80
81
#
82
# A bit bigger test
83
# The 'replace_column' statements are needed because the cardinality calculated
84
# by innodb is not always the same between runs
85
#
86
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
87
eval create $temp table t1 (
685.4.4 by Jay Pipes
Re-enabled and fixed the mix2_myisam test.
88
  id int NOT NULL auto_increment,
89
  parent_id int DEFAULT '0' NOT NULL,
90
  level int DEFAULT '0' NOT NULL,
1 by brian
clean slate
91
  PRIMARY KEY (id),
92
  KEY parent_id (parent_id),
93
  KEY level (level)
94
) engine=$engine_type;
95
INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2);
96
update t1 set parent_id=parent_id+100;
97
select * from t1 where parent_id=102;
98
update t1 set id=id+1000;
99
-- error ER_DUP_ENTRY,1022
100
update t1 set id=1024 where id=1009;
101
select * from t1;
102
update ignore t1 set id=id+1; # This will change all rows
103
select * from t1;
104
update ignore t1 set id=1023 where id=1010;
105
select * from t1 where parent_id=102;
106
--replace_column 9 #
107
explain select level from t1 where level=1;
108
--replace_column 9 #
109
explain select level,id from t1 where level=1;
110
--replace_column 9 #
111
explain select level,id,parent_id from t1 where level=1;
112
select level,id from t1 where level=1;
113
select level,id,parent_id from t1 where level=1;
114
optimize table t1;
115
--replace_column 7 #
116
show keys from t1;
117
drop table t1;
118
119
#
120
# Test replace
121
#
122
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
123
eval create $temp table t1 (
685.4.4 by Jay Pipes
Re-enabled and fixed the mix2_myisam test.
124
  gesuchnr int DEFAULT '0' NOT NULL,
125
  benutzer_id int DEFAULT '0' NOT NULL,
1 by brian
clean slate
126
  PRIMARY KEY (gesuchnr,benutzer_id)
127
) engine=$engine_type;
128
129
replace into t1 (gesuchnr,benutzer_id) values (2,1);
130
replace into t1 (gesuchnr,benutzer_id) values (1,1);
131
replace into t1 (gesuchnr,benutzer_id) values (1,1);
132
select * from t1;
133
drop table t1;
134
135
#
136
# test delete using hidden_primary_key
137
#
138
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
139
eval create $temp table t1 (a int) engine=$engine_type;
1 by brian
clean slate
140
insert into t1 values (1), (2);
141
optimize table t1;
142
delete from t1 where a = 1;
143
select * from t1;
144
check table t1;
145
drop table t1;
146
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
147
eval create $temp table t1 (a int,b varchar(20)) engine=$engine_type;
1 by brian
clean slate
148
insert into t1 values (1,""), (2,"testing");
149
delete from t1 where a = 1;
150
select * from t1;
151
create index skr on t1 (a);
152
insert into t1 values (3,""), (4,"testing");
153
analyze table t1;
154
--replace_column 7 #
155
show keys from t1;
156
drop table t1;
157
158
159
# Test of reading on secondary key with may be null
160
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
161
eval create $temp table t1 (a int,b varchar(20),key(a)) engine=$engine_type;
1 by brian
clean slate
162
insert into t1 values (1,""), (2,"testing");
163
select * from t1 where a = 1;
164
drop table t1;
165
166
if ($test_transactions)
167
{
168
#
169
# Test rollback
170
#
171
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
172
eval create $temp table t1 (n int not null primary key) engine=$engine_type;
1 by brian
clean slate
173
set autocommit=0;
174
insert into t1 values (4);
175
rollback;
176
select n, "after rollback" from t1;
177
insert into t1 values (4);
178
commit;
179
select n, "after commit" from t1;
180
commit;
181
insert into t1 values (5);
182
-- error ER_DUP_ENTRY
183
insert into t1 values (4);
184
commit;
185
select n, "after commit" from t1;
186
set autocommit=1;
187
insert into t1 values (6);
188
-- error ER_DUP_ENTRY
189
insert into t1 values (4);
190
select n from t1;
191
set autocommit=0;
192
#
193
# savepoints
194
#
195
begin;
196
savepoint `my_savepoint`;
197
insert into t1 values (7);
198
savepoint `savept2`;
199
insert into t1 values (3);
200
select n from t1;
201
savepoint savept3;
202
rollback to savepoint savept2;
203
--error 1305
204
rollback to savepoint savept3;
205
rollback to savepoint savept2;
206
release savepoint `my_savepoint`;
207
select n from t1;
208
-- error 1305
209
rollback to savepoint `my_savepoint`;
210
--error 1305
211
rollback to savepoint savept2;
212
insert into t1 values (8);
213
savepoint sv;
214
commit;
215
savepoint sv;
216
set autocommit=1;
217
# nop
218
rollback;
219
drop table t1;
220
221
#
222
# Test for commit and FLUSH TABLES WITH READ LOCK
223
#
224
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
225
eval create $temp table t1 (n int not null primary key) engine=$engine_type;
1 by brian
clean slate
226
start transaction;
227
insert into t1 values (4);
228
flush tables with read lock;
229
#
230
# Current code can't handle a read lock in middle of transaction
231
#--error 1223;
232
commit;
233
unlock tables;
234
commit;
235
select * from t1;
236
drop table t1;
237
238
#
239
# Testing transactions
240
#
241
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
242
eval create $temp table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) engine=$engine_type;
1 by brian
clean slate
243
begin;
244
insert into t1 values(1,'hamdouni');
245
select id as afterbegin_id,nom as afterbegin_nom from t1;
246
rollback;
247
select id as afterrollback_id,nom as afterrollback_nom from t1;
248
set autocommit=0;
249
insert into t1 values(2,'mysql');
250
select id as afterautocommit0_id,nom as afterautocommit0_nom from t1;
251
rollback;
252
select id as afterrollback_id,nom as afterrollback_nom from t1;
253
set autocommit=1;
254
drop table t1;
255
256
#
257
# Simple not autocommit test
258
#
259
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
260
eval create $temp table t1 (id char(8) not null primary key, val int not null) engine=$engine_type;
1 by brian
clean slate
261
insert into t1 values ('pippo', 12);
262
-- error ER_DUP_ENTRY
263
insert into t1 values ('pippo', 12); # Gives error
264
delete from t1;
265
delete from t1 where id = 'pippo';
266
select * from t1;
267
268
insert into t1 values ('pippo', 12);
269
set autocommit=0;
270
delete from t1;
271
rollback;
272
select * from t1;
273
delete from t1;
274
commit;
275
select * from t1;
276
drop table t1;
277
278
#
279
# Test of active transactions
280
#
281
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
282
eval create $temp table t1 (a integer) engine=$engine_type;
1 by brian
clean slate
283
start transaction;
284
rename table t1 to t2;
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
285
eval create $temp table t1 (b integer) engine=$engine_type;
1 by brian
clean slate
286
insert into t1 values (1);
287
rollback;
288
drop table t1;
289
rename table t2 to t1;
290
drop table t1;
291
set autocommit=1;
292
293
#
294
# The following simple tests failed at some point
295
#
296
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
297
eval create $temp table t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) ENGINE=$engine_type;
1 by brian
clean slate
298
INSERT INTO t1 VALUES (1, 'Jochen');
299
select * from t1;
300
drop table t1;
301
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
302
eval create $temp table t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) ENGINE=$engine_type;
1 by brian
clean slate
303
set autocommit=0;
304
INSERT INTO t1  SET _userid='marc@anyware.co.uk';
305
COMMIT;
306
SELECT * FROM t1;
307
SELECT _userid FROM t1 WHERE _userid='marc@anyware.co.uk';
308
drop table t1;
309
set autocommit=1;
310
311
}
312
# End of transactional tests
313
314
#
315
# Test when reading on part of unique key
316
#
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
317
eval create $temp table t1 (
685.4.4 by Jay Pipes
Re-enabled and fixed the mix2_myisam test.
318
  user_id int DEFAULT '0' NOT NULL,
1 by brian
clean slate
319
  name varchar(100),
320
  phone varchar(100),
321
  ref_email varchar(100) DEFAULT '' NOT NULL,
322
  detail varchar(200),
323
  PRIMARY KEY (user_id,ref_email)
324
)engine=$engine_type;
325
326
INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar');
327
select * from t1 where user_id=10292;
328
INSERT INTO t1 VALUES (10291,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10293,'shirish','2333604','shirish@yahoo.com','ddsds');
329
select * from t1 where user_id=10292;
330
select * from t1 where user_id>=10292;
331
select * from t1 where user_id>10292;
332
select * from t1 where user_id<10292;
333
drop table t1;
334
335
#
336
# Test that keys are created in right order
337
#
338
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
339
eval create $temp table t1 (a int not null, b int not null,c int not null,
1 by brian
clean slate
340
key(a),primary key(a,b), unique(c),key(a),unique(b)) ENGINE = $engine_type;
341
--replace_column 7 #
342
show index from t1;
343
drop table t1;
344
345
#
346
# Test of ALTER TABLE and innodb tables
347
#
348
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
349
eval create $temp table t1 (col1 int not null, col2 char(4) not null, primary key(col1)) ENGINE = $other_engine_type;
1 by brian
clean slate
350
eval alter table t1 engine=$engine_type;
351
insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4');
352
select * from t1;
353
update t1 set col2='7' where col1='4';
354
select * from t1;
355
alter table t1 add co3 int not null;
356
select * from t1;
357
update t1 set col2='9' where col1='2';
358
select * from t1;
359
drop table t1;
360
361
#
362
# INSERT INTO innodb tables
363
#
364
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
365
eval create $temp table t1 (a int not null , b int, primary key (a)) engine = $engine_type;
366
eval create $temp table t2 (a int not null , b int, primary key (a)) engine = $other_engine_type;
1 by brian
clean slate
367
insert into t1 VALUES (1,3) , (2,3), (3,3);
368
select * from t1;
369
insert into t2 select * from t1;
370
select * from t2;
371
delete from t1 where b = 3;
372
select * from t1;
373
insert into t1 select * from t2;
374
select * from t1;
375
select * from t2;
376
drop table t1,t2;
377
378
#
379
# Search on unique key
380
#
381
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
382
eval create $temp table t1 (
685.4.4 by Jay Pipes
Re-enabled and fixed the mix2_myisam test.
383
  id int NOT NULL auto_increment,
1217 by Brian Aker
Removed bits of charset support from the parser.
384
  ggid varchar(32) DEFAULT '' NOT NULL,
1 by brian
clean slate
385
  email varchar(64) DEFAULT '' NOT NULL,
1217 by Brian Aker
Removed bits of charset support from the parser.
386
  passwd varchar(32) DEFAULT '' NOT NULL,
1 by brian
clean slate
387
  PRIMARY KEY (id),
388
  UNIQUE ggid (ggid)
389
) ENGINE=$engine_type;
390
391
insert into t1 (ggid,passwd) values ('test1','xxx');
392
insert into t1 (ggid,passwd) values ('test2','yyy');
393
-- error ER_DUP_ENTRY
394
insert into t1 (ggid,passwd) values ('test2','this will fail');
395
-- error ER_DUP_ENTRY
396
insert into t1 (ggid,id) values ('this will fail',1);
397
398
select * from t1 where ggid='test1';
399
select * from t1 where passwd='xxx';
400
select * from t1 where id=2;
401
402
replace into t1 (ggid,id) values ('this will work',1);
403
replace into t1 (ggid,passwd) values ('test2','this will work');
404
-- error ER_DUP_ENTRY
405
update t1 set id=100,ggid='test2' where id=1;
406
select * from t1;
407
select * from t1 where id=1;
408
select * from t1 where id=999;
409
drop table t1;
410
411
#
412
# ORDER BY on not primary key
413
#
414
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
415
eval create $temp table t1 (
1 by brian
clean slate
416
  user_name varchar(12),
417
  password text,
418
  subscribed char(1),
685.4.4 by Jay Pipes
Re-enabled and fixed the mix2_myisam test.
419
  user_id int DEFAULT '0' NOT NULL,
420
  quota bigint,
1 by brian
clean slate
421
  weight double,
422
  access_date date,
423
  approved datetime,
685.4.4 by Jay Pipes
Re-enabled and fixed the mix2_myisam test.
424
  dummy_primary_key int NOT NULL auto_increment,
1 by brian
clean slate
425
  PRIMARY KEY (dummy_primary_key)
426
) ENGINE=$engine_type;
896.5.1 by Jay Pipes
Removes the TIME column type and related time functions.
427
INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','2000-09-07 23:06:59',1);
428
INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','2000-09-07 23:06:59',2);
429
INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','2000-09-07 23:06:59',3);
430
INSERT INTO t1 VALUES ('user_3','somepassword','Y',3,3,1.7320508075689,'2000-09-07','2000-09-07 23:06:59',4);
431
INSERT INTO t1 VALUES ('user_4','somepassword','N',4,4,2,'2000-09-07','2000-09-07 23:06:59',5);
432
select  user_name, password , subscribed, user_id, quota, weight, access_date, approved, dummy_primary_key from t1 order by user_name;
1 by brian
clean slate
433
drop table t1;
434
435
#
436
# Testing of tables without primary keys
437
#
438
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
439
eval create $temp table t1 (
685.4.4 by Jay Pipes
Re-enabled and fixed the mix2_myisam test.
440
  id int NOT NULL auto_increment,
441
  parent_id int DEFAULT '0' NOT NULL,
442
  level int DEFAULT '0' NOT NULL,
1 by brian
clean slate
443
  KEY (id),
444
  KEY parent_id (parent_id),
445
  KEY level (level)
446
) engine=$engine_type;
447
INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1);
448
INSERT INTO t1 values (179,5,2);
449
update t1 set parent_id=parent_id+100;
450
select * from t1 where parent_id=102;
451
update t1 set id=id+1000;
452
update t1 set id=1024 where id=1009;
453
select * from t1;
454
update ignore t1 set id=id+1; # This will change all rows
455
select * from t1;
456
update ignore t1 set id=1023 where id=1010;
457
select * from t1 where parent_id=102;
458
--replace_column 9 #
459
explain select level from t1 where level=1;
460
select level,id from t1 where level=1;
461
select level,id,parent_id from t1 where level=1;
462
select level,id from t1 where level=1 order by id;
463
delete from t1 where level=1;
464
select * from t1;
465
drop table t1;
466
467
#
468
# Test of index only reads
469
#
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
470
eval create $temp table t1 (
1 by brian
clean slate
471
   sca_code char(6) NOT NULL,
472
   cat_code char(6) NOT NULL,
473
   sca_desc varchar(50),
474
   lan_code char(2) NOT NULL,
475
   sca_pic varchar(100),
476
   sca_sdesc varchar(50),
477
   sca_sch_desc varchar(16),
478
   PRIMARY KEY (sca_code, cat_code, lan_code),
479
   INDEX sca_pic (sca_pic)
480
) engine = $engine_type ;
481
482
INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING');
483
select count(*) from t1 where sca_code = 'PD';
484
select count(*) from t1 where sca_code <= 'PD';
485
select count(*) from t1 where sca_pic is null;
486
alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic);
487
select count(*) from t1 where sca_code='PD' and sca_pic is null;
488
select count(*) from t1 where cat_code='E';
489
490
alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
491
select count(*) from t1 where sca_code='PD' and sca_pic is null;
492
select count(*) from t1 where sca_pic >= 'n';
493
select sca_pic from t1 where sca_pic is null;
494
update t1 set sca_pic="test" where sca_pic is null;
495
delete from t1 where sca_code='pd';
496
drop table t1;
497
498
#
499
# Test of opening table twice and timestamps
500
#
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
501
--echo $temp
502
if(!$using_temp)
503
{
1 by brian
clean slate
504
set @a:=now();
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
505
eval create $temp table t1 (a int not null, b timestamp not null, primary key (a)) engine=$engine_type;
1 by brian
clean slate
506
insert into t1 (a) values(1),(2),(3);
507
select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a;
508
select a from t1 natural join t1 as t2 where b >= @a order by a;
509
update t1 set a=5 where a=1;
510
select a from t1;
511
drop table t1;
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
512
}
1 by brian
clean slate
513
#
514
# Test with variable length primary key
515
#
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
516
eval create $temp table t1 (a varchar(100) not null, primary key(a), b int not null) engine=$engine_type;
1 by brian
clean slate
517
insert into t1 values("hello",1),("world",2);
518
select * from t1 order by b desc;
519
optimize table t1;
520
--replace_column 7 #
521
show keys from t1;
522
drop table t1;
523
524
#
525
# Test of create index with NULL columns
526
#
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
527
eval create $temp table t1 (i int, j int ) ENGINE=$engine_type;
1 by brian
clean slate
528
insert into t1 values (1,2);
529
select * from t1 where i=1 and j=2;
530
create index ax1 on t1 (i,j);
531
select * from t1 where i=1 and j=2;
532
drop table t1;
533
534
#
535
# Test min-max optimization
536
#
537
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
538
eval create $temp table t1 (
685.4.4 by Jay Pipes
Re-enabled and fixed the mix2_myisam test.
539
  a int NOT NULL,
540
  b int NOT NULL,
1 by brian
clean slate
541
  UNIQUE (a, b)
542
) ENGINE = $engine_type;
543
544
INSERT INTO t1 VALUES (1, 1);
545
SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1;
546
drop table t1;
547
548
#
549
# Test INSERT DELAYED
550
#
551
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
552
eval create $temp table t1 (a int NOT NULL) engine=$engine_type;
1 by brian
clean slate
553
# Can't test this in 3.23
554
# INSERT DELAYED INTO t1 VALUES (1);
555
INSERT INTO t1 VALUES (1);
556
SELECT * FROM t1;
557
DROP TABLE t1;
558
559
560
#
561
# Crash when using many tables (Test case by Jeremy D Zawodny)
562
#
563
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
564
eval create $temp table t1 (a int  primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) engine = $engine_type;
1 by brian
clean slate
565
insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
566
--replace_column 9 #
567
explain select * from t1 where a > 0 and a < 50;
568
drop table t1;
569
570
#
571
# Test prefix key
572
#
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
573
eval create $temp table t1 (a char(20), unique (a(5))) engine=$engine_type;
1 by brian
clean slate
574
drop table t1;
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
575
eval create $temp table t1 (a char(20), index (a(5))) engine=$engine_type;
1 by brian
clean slate
576
show create table t1;
577
drop table t1;
578
579
#
580
# Test using temporary table and auto_increment
581
#
582
583
eval create temporary table t1 (a int not null auto_increment, primary key(a)) engine=$engine_type;
584
insert into t1 values (NULL),(NULL),(NULL);
585
delete from t1 where a=3;
586
insert into t1 values (NULL);
587
select * from t1;
588
alter table t1 add b int;
589
select * from t1;
590
drop table t1;
591
592
#Slashdot bug
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
593
eval create $temp table t1
1 by brian
clean slate
594
 (
595
  id int auto_increment primary key,
596
  name varchar(32) not null,
597
  value text not null,
598
  uid int not null,
599
  unique key(name,uid)
600
 ) engine=$engine_type;
601
insert into t1 values (1,'one','one value',101),
602
 (2,'two','two value',102),(3,'three','three value',103);
603
replace into t1 (value,name,uid) values ('other value','two',102);
604
delete from t1 where uid=102;
605
replace into t1 (value,name,uid) values ('other value','two',102);
606
replace into t1 (value,name,uid) values ('other value','two',102);
607
select * from t1;
608
drop table t1;
609
610
#
611
# Test DROP DATABASE
612
#
613
# ML: Test logics
614
#     Check that the creation of a table with engine = $engine_type does
615
#     in a certain database (already containing some tables using other
616
#     storage engines) not prevent the dropping of this database.
617
618
create database mysqltest;
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
619
eval create $temp table mysqltest.t1 (a int not null) engine= $engine_type;
1 by brian
clean slate
620
insert into mysqltest.t1 values(1);
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
621
eval create $temp table mysqltest.t2 (a int not null) engine= $other_engine_type;
1 by brian
clean slate
622
insert into mysqltest.t2 values(1);
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
623
eval create $temp table mysqltest.t3 (a int not null) engine= $other_engine_type1;
1 by brian
clean slate
624
insert into mysqltest.t3 values(1);
625
commit;
626
drop database mysqltest;
627
# Don't check error message
628
--error 1049
629
show tables from mysqltest;
630
631
#
632
# Test truncate table with and without auto_commit
633
#
634
635
set autocommit=0;
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
636
eval create $temp table t1 (a int not null) engine= $engine_type;
1 by brian
clean slate
637
insert into t1 values(1),(2);
638
truncate table t1;
639
commit;
640
truncate table t1;
641
truncate table t1;
642
select * from t1;
643
insert into t1 values(1),(2);
644
delete from t1;
645
select * from t1;
646
commit;
647
drop table t1;
648
set autocommit=1;
649
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
650
eval create $temp table t1 (a int not null) engine= $engine_type;
1 by brian
clean slate
651
insert into t1 values(1),(2);
652
truncate table t1;
653
insert into t1 values(1),(2);
654
select * from t1;
655
truncate table t1;
656
insert into t1 values(1),(2);
657
delete from t1;
658
select * from t1;
659
drop table t1;
660
661
#
662
# Test of how ORDER BY works when doing it on the whole table
663
#
664
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
665
eval create $temp table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=$engine_type;
1 by brian
clean slate
666
insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
667
--replace_column 9 #
668
explain select * from t1 order by a;
669
--replace_column 9 #
670
explain select * from t1 order by b;
671
--replace_column 9 #
672
explain select * from t1 order by c;
673
--replace_column 9 #
674
explain select a from t1 order by a;
675
--replace_column 9 #
676
explain select b from t1 order by b;
677
--replace_column 9 #
678
explain select a,b from t1 order by b;
679
--replace_column 9 #
680
explain select a,b from t1;
681
--replace_column 9 #
682
explain select a,b,c from t1;
683
drop table t1;
684
685
#
686
# Check describe
687
#
688
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
689
eval create $temp table t1 (t int not null default 1, key (t)) engine=$engine_type;
1 by brian
clean slate
690
desc t1;
691
drop table t1;
692
693
#
694
# A simple test with some isolation levels
695
# TODO: Make this into a test using replication to really test how
696
# this works.
697
#
698
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
699
eval create $temp table t1 (id int not null auto_increment, code int not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=$engine_type;
1 by brian
clean slate
700
701
BEGIN;
702
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
703
SELECT @@tx_isolation,@@global.tx_isolation;
704
insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David');
705
select id, code, name from t1 order by id;
706
COMMIT;
707
708
BEGIN;
709
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
710
insert into t1 (code, name) values (2, 'Erik'), (3, 'Sasha');
711
select id, code, name from t1 order by id;
712
COMMIT;
713
714
BEGIN;
715
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
716
insert into t1 (code, name) values (3, 'Jeremy'), (4, 'Matt');
717
select id, code, name from t1 order by id;
718
COMMIT;
719
DROP TABLE t1;
720
721
#
722
# Testing of IFNULL
723
#
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
724
if(!$using_temp)
725
{
726
eval create $temp table t1 (a int, b int) engine=$engine_type;
1 by brian
clean slate
727
insert into t1 values(20,null);
728
select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
729
t2.b=t3.a;
730
select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
731
t2.b=t3.a order by 1;
732
insert into t1 values(10,null);
733
select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
734
t2.b=t3.a order by 1;
735
drop table t1;
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
736
}
1 by brian
clean slate
737
738
if ($test_foreign_keys)
739
{
740
#
741
# Test of multi-table-delete with foreign key constraints
742
#
743
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
744
eval create $temp table t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=$engine_type;
745
eval create $temp table t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (t1_id) REFERENCES t1(id)  ON DELETE CASCADE ) ENGINE=$engine_type;
1 by brian
clean slate
746
insert into t1 set id=1;
747
insert into t2 set id=1, t1_id=1;
748
delete t1,t2 from t1,t2 where t1.id=t2.t1_id;
749
select * from t1;
750
select * from t2;
751
drop table t2,t1;
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
752
eval create $temp table t1(id INT NOT NULL,  PRIMARY KEY (id)) ENGINE=$engine_type;
753
eval create $temp table t2(id  INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id)  ) ENGINE=$engine_type;
1 by brian
clean slate
754
INSERT INTO t1 VALUES(1);
755
INSERT INTO t2 VALUES(1, 1);
756
SELECT * from t1;
757
UPDATE t1,t2 SET t1.id=t1.id+1, t2.t1_id=t1.id+1;
758
SELECT * from t1;
759
UPDATE t1,t2 SET t1.id=t1.id+1 where t1.id!=t2.id;
760
SELECT * from t1;
761
DROP TABLE t1,t2;
762
}
763
764
if ($test_transactions)
765
{
766
#
767
# Test of range_optimizer
768
#
769
770
set autocommit=0;
771
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
772
eval create $temp table t1 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=$engine_type;
773
774
eval create $temp table t2 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=$engine_type;
775
776
eval create $temp table t3 (id1 CHAR(15) NOT NULL, id2 CHAR(15) NOT NULL, PRIMARY KEY(id1, id2)) ENGINE=$engine_type;
1 by brian
clean slate
777
778
INSERT INTO t3 VALUES("my-test-1", "my-test-2");
779
COMMIT;
780
781
INSERT INTO t1 VALUES("this-key", "will disappear");
782
INSERT INTO t2 VALUES("this-key", "will also disappear");
783
DELETE FROM t3 WHERE id1="my-test-1";
784
785
SELECT * FROM t1;
786
SELECT * FROM t2;
787
SELECT * FROM t3;
788
ROLLBACK;
789
790
SELECT * FROM t1;
791
SELECT * FROM t2;
792
SELECT * FROM t3;
793
SELECT * FROM t3 WHERE id1="my-test-1" LOCK IN SHARE MODE;
794
COMMIT;
795
set autocommit=1;
796
DROP TABLE t1,t2,t3;
797
}
798
799
#
800
# Check update with conflicting key
801
#
802
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
803
eval create $temp table t1 (a int not null primary key, b int not null, unique (b)) engine=$engine_type;
1 by brian
clean slate
804
INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
805
# We need the a < 1000 test here to quard against the halloween problems
806
UPDATE t1 set a=a+100 where b between 2 and 3 and a < 1000;
807
SELECT * from t1;
808
drop table t1;
809
810
#
811
# Test that MySQL priorities clustered indexes
812
#
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
813
eval create $temp table t1 (a int not null auto_increment primary key, b int, c int, key(c)) engine=$engine_type;
814
eval create $temp table t2 (a int not null auto_increment primary key, b int) ENGINE = $other_engine_type;
1 by brian
clean slate
815
insert into t1 (b) values (null),(null),(null),(null),(null),(null),(null);
816
insert into t2 (a) select b from t1;
817
insert into t1 (b) select b from t2;
818
insert into t2 (a) select b from t1;
819
insert into t1 (a) select b from t2;
820
insert into t2 (a) select b from t1;
821
insert into t1 (a) select b from t2;
822
insert into t2 (a) select b from t1;
823
insert into t1 (a) select b from t2;
824
insert into t2 (a) select b from t1;
825
insert into t1 (a) select b from t2;
826
insert into t2 (a) select b from t1;
827
insert into t1 (a) select b from t2;
828
insert into t2 (a) select b from t1;
829
insert into t1 (a) select b from t2;
830
insert into t2 (a) select b from t1;
831
insert into t1 (a) select b from t2;
832
insert into t2 (a) select b from t1;
833
insert into t1 (a) select b from t2;
834
select count(*) from t1;
835
--replace_column 9 #
836
explain select * from t1 where c between 1 and 2500;
837
update t1 set c=a;
838
--replace_column 9 #
839
explain select * from t1 where c between 1 and 2500;
840
drop table t1,t2;
841
842
#
843
# Test of UPDATE ... ORDER BY
844
#
845
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
846
eval create $temp table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=$engine_type;
1 by brian
clean slate
847
848
insert into t1 (id) values (null),(null),(null),(null),(null);
849
update t1 set fk=69 where fk is null order by id limit 1;
850
SELECT * from t1;
851
drop table t1;
852
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
853
eval create $temp table t1 (a int not null, b int not null, key (a)) engine=$engine_type;
1 by brian
clean slate
854
insert into t1 values (1,1),(1,2),(1,3),(3,1),(3,2),(3,3),(3,1),(3,2),(3,3),(2,1),(2,2),(2,3);
855
SET @tmp=0;
856
update t1 set b=(@tmp:=@tmp+1) order by a;
857
update t1 set b=99 where a=1 order by b asc limit 1;
858
update t1 set b=100 where a=1 order by b desc limit 2;
859
update t1 set a=a+10+b where a=1 order by b;
860
select * from t1 order by a,b;
861
drop table t1;
862
863
#
864
# test autoincrement with TRUNCATE
865
#
866
867
SET AUTOCOMMIT=1;
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
868
eval create $temp table t1 (a integer auto_increment primary key) engine=$engine_type;
1 by brian
clean slate
869
insert into t1 (a) values (NULL),(NULL);
870
truncate table t1;
871
insert into t1 (a) values (NULL),(NULL);
872
SELECT * from t1;
873
drop table t1;
874
875
876
if ($test_foreign_keys)
877
{
878
#
879
# Test dictionary handling with spaceand quoting
880
#
881
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
882
eval create $temp table t1 (`id 1` INT NOT NULL, PRIMARY KEY (`id 1`)) ENGINE=$engine_type;
883
eval create $temp table t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (`t1_id`) REFERENCES `t1`(`id 1`)  ON DELETE CASCADE ) ENGINE=$engine_type;
1 by brian
clean slate
884
#show create table t2;
885
drop table t2,t1;
886
887
#
888
# Test of multi updated and foreign keys
889
#
890
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
891
eval create $temp table `t1` (`id` int not null  ,primary key ( `id` )) engine = $engine_type;
1 by brian
clean slate
892
insert into `t1`values ( 1 ) ;
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
893
eval create $temp table `t2` (`id` int not null default '0',unique key `id` ( `id` ) ,constraint `t1_id_fk` foreign key ( `id` ) references `t1` (`id` )) engine = $engine_type;
1 by brian
clean slate
894
insert into `t2`values ( 1 ) ;
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
895
eval create $temp table `t3` (`id` int not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) engine = $engine_type;
1 by brian
clean slate
896
insert into `t3`values ( 1 ) ;
897
--error 1451
898
delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
899
--error 1451
900
update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7  where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
901
--error 1054
902
update t3 set  t3.id=7  where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
903
drop table t3,t2,t1;
904
905
#
906
# test for recursion depth limit
907
#
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
908
eval create $temp table t1(
1 by brian
clean slate
909
	id int primary key,
910
	pid int,
911
	index(pid),
912
	foreign key(pid) references t1(id) on delete cascade) engine=$engine_type;
913
insert into t1 values(0,0),(1,0),(2,1),(3,2),(4,3),(5,4),(6,5),(7,6),
914
	(8,7),(9,8),(10,9),(11,10),(12,11),(13,12),(14,13),(15,14);
915
-- error 1451
916
delete from t1 where id=0;
917
delete from t1 where id=15;
918
delete from t1 where id=0;
919
920
drop table t1;
921
}
922
# End of FOREIGN KEY tests
923
924
#
925
# Test timestamps
926
#
927
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
928
eval create $temp table t1 (col1 int)ENGINE=$engine_type;
929
eval create $temp table t2 (col1 int,stamp TIMESTAMP,INDEX stamp_idx
1 by brian
clean slate
930
(stamp))ENGINE=$engine_type;
931
insert into t1 values (1),(2),(3);
932
# Note that timestamp 3 is wrong
907.1.7 by Jay Pipes
Merged in remove-timezone work
933
--error 1685 # Bad timestamp
1 by brian
clean slate
934
insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 ),(5,20020204230000);
935
SELECT col1 FROM t1 UNION SELECT col1 FROM t2 WHERE stamp <
936
'20020204120000' GROUP BY col1;
937
drop table t1,t2;
938
939
#
940
# Test by Francois MASUREL
941
#
942
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
943
if(!$using_temp)
944
{
945
eval create $temp table t1 (
685.4.4 by Jay Pipes
Re-enabled and fixed the mix2_myisam test.
946
  `id` int NOT NULL auto_increment,
947
  `id_object` int default '0',
948
  `id_version` int NOT NULL default '1',
1 by brian
clean slate
949
  `label` varchar(100) NOT NULL default '',
950
  `description` text,
951
  PRIMARY KEY  (`id`),
952
  KEY `id_object` (`id_object`),
953
  KEY `id_version` (`id_version`)
954
) ENGINE=$engine_type;
955
956
INSERT INTO t1 VALUES("6", "3382", "9", "Test", NULL), ("7", "102", "5", "Le Pekin (Test)", NULL),("584", "1794", "4", "Test de resto", NULL),("837", "1822", "6", "Test 3", NULL),("1119", "3524", "1", "Societe Test", NULL),("1122", "3525", "1", "Fournisseur Test", NULL);
957
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
958
eval create $temp table t2 (
685.4.4 by Jay Pipes
Re-enabled and fixed the mix2_myisam test.
959
  `id` int NOT NULL auto_increment,
960
  `id_version` int NOT NULL default '1',
1 by brian
clean slate
961
  PRIMARY KEY  (`id`),
962
  KEY `id_version` (`id_version`)
963
) ENGINE=$engine_type;
964
965
INSERT INTO t2 VALUES("3524", "1"),("3525", "1"),("1794", "4"),("102", "5"),("1822", "6"),("3382", "9");
966
967
SELECT t2.id, t1.`label` FROM t2 INNER JOIN
968
(SELECT t1.id_object as id_object FROM t1 WHERE t1.`label` LIKE '%test%') AS lbl
969
ON (t2.id = lbl.id_object) INNER JOIN t1 ON (t2.id = t1.id_object);
970
drop table t1,t2;
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
971
}
1 by brian
clean slate
972
973
# Live checksum feature available + enabled
1117.1.2 by Brian Aker
Remove CHECKSUM option in create table.
974
eval create $temp table t1 (a int, b varchar(200), c text not null) engine=$other_live_chks_engine_type;
1 by brian
clean slate
975
# Live checksum feature available + disabled
1117.1.2 by Brian Aker
Remove CHECKSUM option in create table.
976
eval create $temp table t2 (a int, b varchar(200), c text not null) engine=$other_live_chks_engine_type;
1 by brian
clean slate
977
#
978
# Live checksum feature not available + enabled
1117.1.2 by Brian Aker
Remove CHECKSUM option in create table.
979
eval create $temp table t3 (a int, b varchar(200), c varchar(200) not null) engine=$other_non_live_chks_engine_type;
1 by brian
clean slate
980
# Live checksum feature not available + disabled
1117.1.2 by Brian Aker
Remove CHECKSUM option in create table.
981
eval create $temp table t4 (a int, b varchar(200), c varchar(200) not null) engine=$other_non_live_chks_engine_type;
1 by brian
clean slate
982
#
983
# Live checksum feature probably available + enabled
1117.1.2 by Brian Aker
Remove CHECKSUM option in create table.
984
eval create $temp table t5 (a int, b varchar(200), c text not null) engine=$engine_type;
1 by brian
clean slate
985
# Live checksum feature probably available + disabled
1117.1.2 by Brian Aker
Remove CHECKSUM option in create table.
986
eval create $temp table t6 (a int, b varchar(200), c text not null) engine=$engine_type;
1 by brian
clean slate
987
#
988
insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
989
insert t2 select * from t1;
990
insert t3 select * from t1;
991
insert t4 select * from t1;
992
insert t5 select * from t1;
993
insert t6 select * from t1;
994
checksum table t1, t2, t3, t4, t5, t6, t7 quick;
995
checksum table t1, t2, t3, t4, t5, t6, t7;
996
checksum table t1, t2, t3, t4, t5, t6, t7 extended;
997
# #show table status;
998
drop table t1,t2,t3, t4, t5, t6;
999
1000
#
1001
# Test problem with refering to different fields in same table in UNION
1002
# (Bug#2552: UNION returns NULL instead of expected value (innoDB only tables))
1003
#
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1004
if(!$using_temp)
1005
{
1006
eval create $temp table t1 (id int,  name char(10) not null,  name2 char(10) not null) engine=$engine_type;
1 by brian
clean slate
1007
insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt');
1008
select trim(name2) from t1  union all  select trim(name) from t1 union all select trim(id) from t1;
1009
drop table t1;
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1010
}
1011
#
1012
# Bug#2160: Extra error message for create $temp table LIKE with InnoDB
1013
#
1014
eval create $temp table t1 (a int) engine=$engine_type;
1 by brian
clean slate
1015
create table t2 like t1;
1016
show create table t2;
1017
drop table t1,t2;
1018
1019
if ($test_foreign_keys)
1020
{
1021
#
1022
# Test of automaticly created foreign keys
1023
#
1024
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1025
eval create $temp table t1 (id int not null, id2 int not null, unique (id,id2)) engine=$engine_type;
1026
eval create $temp table t2 (id int not null, constraint t1_id_fk foreign key ( id ) references t1 (id)) engine = $engine_type;
1 by brian
clean slate
1027
show create table t1;
1028
show create table t2;
1029
create index id on t2 (id);
1030
show create table t2;
1031
create index id2 on t2 (id);
1032
show create table t2;
1033
drop index id2 on t2;
1034
--error 1025,1025
1035
drop index id on t2;
1036
show create table t2;
1037
drop table t2;
1038
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1039
eval create $temp table t2 (id int not null, id2 int not null, constraint t1_id_fk foreign key (id,id2) references t1 (id,id2)) engine = $engine_type;
1 by brian
clean slate
1040
show create table t2;
1041
create unique index id on t2 (id,id2);
1042
show create table t2;
1043
drop table t2;
1044
1045
# Check foreign key columns created in different order than key columns
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1046
eval create $temp table t2 (id int not null, id2 int not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = $engine_type;
1047
show create table t2;
1048
drop table t2;
1049
1050
eval create $temp table t2 (id int not null, id2 int not null, unique (id,id2), constraint t1_id_fk foreign key (id) references t1 (id)) engine = $engine_type;
1051
show create table t2;
1052
drop table t2;
1053
1054
eval create $temp table t2 (id int not null, id2 int not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = $engine_type;
1055
show create table t2;
1056
drop table t2;
1057
1058
eval create $temp table t2 (id int not null auto_increment, id2 int not null, constraint t1_id_fk foreign key (id) references t1 (id), primary key (id), index (id,id2)) engine = $engine_type;
1059
show create table t2;
1060
drop table t2;
1061
1062
eval create $temp table t2 (id int not null auto_increment, id2 int not null, constraint t1_id_fk foreign key (id) references t1 (id)) engine= $engine_type;
1 by brian
clean slate
1063
show create table t2;
1064
alter table t2 add index id_test (id), add index id_test2 (id,id2);
1065
show create table t2;
1066
drop table t2;
1067
1068
# Test error handling
1069
1070
# Clean up filename -- embedded server reports whole path without .frm,
1071
# regular server reports relative path with .frm (argh!)
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
1072
--replace_result \\ / $DRIZZLE_TEST_DIR . /var/master-data/ / t2.frm t2
1 by brian
clean slate
1073
--error 1005
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1074
eval create $temp table t2 (id int not null, id2 int not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = $engine_type;
1 by brian
clean slate
1075
1076
# bug#3749
1077
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1078
eval create $temp table t2 (a int auto_increment primary key, b int, index(b), foreign key (b) references t1(id), unique(b)) engine=$engine_type;
1 by brian
clean slate
1079
show create table t2;
1080
drop table t2;
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1081
eval create $temp table t2 (a int auto_increment primary key, b int, foreign key (b) references t1(id), foreign key (b) references t1(id), unique(b)) engine=$engine_type;
1 by brian
clean slate
1082
show create table t2;
1083
drop table t2, t1;
1084
}
1085
# End of FOREIGN KEY tests
1086
1087
1088
#
1089
# Let us test binlog_cache_use and binlog_cache_disk_use status vars.
1090
# Actually this test has nothing to do with innodb per se, it just requires
1091
# transactional table.
1092
#
1093
flush status;
1094
show status like "binlog_cache_use";
1095
show status like "binlog_cache_disk_use";
1096
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1097
eval create $temp table t1 (a int) engine=$engine_type;
1 by brian
clean slate
1098
1099
# Now we are going to create transaction which is long enough so its
1100
# transaction binlog will be flushed to disk...
1101
let $1=2000;
1102
disable_query_log;
1103
begin;
1104
while ($1)
1105
{
1106
 eval insert into t1 values( $1 );
1107
 dec $1;
1108
}
1109
commit;
1110
enable_query_log;
1111
show status like "binlog_cache_use";
1112
show status like "binlog_cache_disk_use";
1113
1114
# Transaction which should not be flushed to disk and so should not
1115
# increase binlog_cache_disk_use.
1116
begin;
1117
delete from t1;
1118
commit;
1119
show status like "binlog_cache_use";
1120
show status like "binlog_cache_disk_use";
1121
drop table t1;
1122
1123
#
1124
# Bug #6126: Duplicate columns in keys gives misleading error message
1125
#
1126
--error 1060
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1127
eval create $temp table t1 (c char(10), index (c,c)) engine=$engine_type;
1128
--error 1060
1129
eval create $temp table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=$engine_type;
1130
--error 1060
1131
eval create $temp table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=$engine_type;
1132
--error 1060
1133
eval create $temp table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=$engine_type;
1134
eval create $temp table t1 (c1 char(10), c2 char(10)) engine=$engine_type;
1 by brian
clean slate
1135
--error 1060
1136
alter table t1 add key (c1,c1);
1137
--error 1060
1138
alter table t1 add key (c2,c1,c1);
1139
--error 1060
1140
alter table t1 add key (c1,c2,c1);
1141
--error 1060
1142
alter table t1 add key (c1,c1,c2);
1143
drop table t1;
1144
1145
#
1146
# Bug #4082: integer truncation
1147
#
1148
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1149
eval create $temp table t1(a int, b int) engine=$engine_type;
1 by brian
clean slate
1150
insert into t1 values ('1111', '3333');
1151
select distinct concat(a, b) from t1;
1152
drop table t1;
1153
1154
if ($fulltext_query_unsupported)
1155
{
1156
#
1157
# BUG#7709 test case - Boolean fulltext query against unsupported
1158
#                      engines does not fail
1159
#
1160
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1161
eval create $temp table t1 ( a char(10) ) ENGINE=$engine_type;
1 by brian
clean slate
1162
--error 1214
1163
SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
1164
DROP TABLE t1;
1165
}
1166
1167
if ($test_foreign_keys)
1168
{
1169
#
1170
# check null values #1
1171
#
1172
1173
--disable_warnings
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1174
eval create $temp table t1 (a_id int NOT NULL default '0', PRIMARY KEY  (a_id)) ENGINE=$engine_type DEFAULT CHARSET=latin1;
1 by brian
clean slate
1175
INSERT INTO t1 VALUES (1),(2),(3);
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1176
eval create $temp table t2 (b_id int NOT NULL default '0',b_a int NOT NULL default '0', PRIMARY KEY  (b_id), KEY  (b_a),
1 by brian
clean slate
1177
                CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=$engine_type DEFAULT CHARSET=latin1;
1178
--enable_warnings
1179
INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2);
1180
SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz;
1181
DROP TABLE t2;
1182
DROP TABLE t1;
1183
}
1184
1185
#
1186
# Bug#11816 - Truncate table doesn't work with temporary innodb tables
1187
# This is not an innodb bug, but we test it using innodb.
1188
#
1189
eval create temporary table t1 (a int) engine=$engine_type;
1190
insert into t1 values (4711);
1191
truncate t1;
1192
insert into t1 values (42);
1193
select * from t1;
1194
drop table t1;
1195
# Show that it works with permanent tables too.
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1196
eval create $temp table t1 (a int) engine=$engine_type;
1 by brian
clean slate
1197
insert into t1 values (4711);
1198
truncate t1;
1199
insert into t1 values (42);
1200
select * from t1;
1201
drop table t1;
1202
1203
#
1204
# Bug #13025  Server crash during filesort	
1205
#
1206
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1207
eval create $temp table t1 (a int not null, b int not null, c blob not null, d int not null, e int, primary key (a,b,c(255),d)) engine=$engine_type;
1 by brian
clean slate
1208
insert into t1 values (2,2,"b",2,2),(1,1,"a",1,1),(3,3,"ab",3,3);
1209
select * from t1 order by a,b,c,d;
1210
explain select * from t1 order by a,b,c,d;
1211
drop table t1;
1212
1213
#
1214
# BUG#11039,#13218 Wrong key length in min()
1215
#
1216
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1217
eval create $temp table t1 (a char(1), b char(1), key(a, b)) engine=$engine_type;
1 by brian
clean slate
1218
insert into t1 values ('8', '6'), ('4', '7');
1219
select min(a) from t1;
1220
select min(b) from t1 where a='8';
1221
drop table t1;
1222
1223
# End of 4.1 tests
1224
1225
#
1226
# range optimizer problem
1227
#
1228
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1229
eval create $temp table t1 (x bigint not null primary key) engine=$engine_type;
685.4.4 by Jay Pipes
Re-enabled and fixed the mix2_myisam test.
1230
# The below is out of range for a BIGINT (signed)
1231
--error 1264
1 by brian
clean slate
1232
insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1);
1233
select * from t1;
1234
select count(*) from t1 where x>0;
1235
select count(*) from t1 where x=0;
1236
select count(*) from t1 where x<0;
1237
select count(*) from t1 where x < -16;
1238
select count(*) from t1 where x = -16;
1239
explain select count(*) from t1 where x > -16;
1240
select count(*) from t1 where x > -16;
1241
select * from t1 where x > -16;
1242
select count(*) from t1 where x = 18446744073709551601;
1243
drop table t1;
1244
1245
# Please do not remove the following skipped InnoDB specific tests.
1246
# They make the synchronization with innodb.test easier and give
1247
# an idea what to test on other storage engines.
1248
if (0)
1249
{
1250
1251
# Test for testable InnoDB status variables. This test
1252
# uses previous ones(pages_created, rows_deleted, ...).
1253
show status like "Innodb_buffer_pool_pages_total";
1254
show status like "Innodb_page_size";
1255
show status like "Innodb_rows_deleted";
1256
show status like "Innodb_rows_inserted";
1257
show status like "Innodb_rows_updated";
1258
1259
# Test for row locks InnoDB status variables.
1260
show status like "Innodb_row_lock_waits";
1261
show status like "Innodb_row_lock_current_waits";
1262
show status like "Innodb_row_lock_time";
1263
show status like "Innodb_row_lock_time_max";
1264
show status like "Innodb_row_lock_time_avg";
1265
1266
# Test for innodb_sync_spin_loops variable
1267
show variables like "innodb_sync_spin_loops";
1268
set global innodb_sync_spin_loops=1000;
1269
show variables like "innodb_sync_spin_loops";
1270
set global innodb_sync_spin_loops=0;
1271
show variables like "innodb_sync_spin_loops";
1272
set global innodb_sync_spin_loops=20;
1273
show variables like "innodb_sync_spin_loops";
1274
1275
# Test for innodb_thread_concurrency variable
1276
show variables like "innodb_thread_concurrency";
1277
set global innodb_thread_concurrency=1001;
1278
show variables like "innodb_thread_concurrency";
1279
set global innodb_thread_concurrency=0;
1280
show variables like "innodb_thread_concurrency";
1281
set global innodb_thread_concurrency=16;
1282
show variables like "innodb_thread_concurrency";
1283
1284
# Test for innodb_concurrency_tickets variable
1285
show variables like "innodb_concurrency_tickets";
1286
set global innodb_concurrency_tickets=1000;
1287
show variables like "innodb_concurrency_tickets";
1288
set global innodb_concurrency_tickets=0;
1289
show variables like "innodb_concurrency_tickets";
1290
set global innodb_concurrency_tickets=500;
1291
show variables like "innodb_concurrency_tickets";
1292
1293
# Test for innodb_thread_sleep_delay variable
1294
show variables like "innodb_thread_sleep_delay";
1295
set global innodb_thread_sleep_delay=100000;
1296
show variables like "innodb_thread_sleep_delay";
1297
set global innodb_thread_sleep_delay=0;
1298
show variables like "innodb_thread_sleep_delay";
1299
set global innodb_thread_sleep_delay=10000;
1300
show variables like "innodb_thread_sleep_delay";
1301
1302
}
1303
1304
1305
#
1306
# Test varchar
1307
#
1308
1309
let $default=`select @@storage_engine`;
1310
eval set storage_engine=$engine_type;
1311
source include/varchar.inc;
1312
1313
#
1314
# Some errors/warnings on create
1315
#
1316
1317
# Clean up filename -- embedded server reports whole path without .frm,
1318
# regular server reports relative path with .frm (argh!)
685.4.4 by Jay Pipes
Re-enabled and fixed the mix2_myisam test.
1319
# @TODO The below fails because it assumes latin1
1320
# as the charset.  Possibly re-enable a similar test
1321
#--replace_result \\ / $DRIZZLE_TEST_DIR . /var/master-data/ / t1.frm t1
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1322
#create $temp table t1 (v varchar(65530), key(v));
685.4.4 by Jay Pipes
Re-enabled and fixed the mix2_myisam test.
1323
#drop table t1;
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1324
#create $temp table t1 (v varchar(65536));
685.4.4 by Jay Pipes
Re-enabled and fixed the mix2_myisam test.
1325
#show create table t1;
1326
#drop table t1;
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1327
#create $temp table t1 (v varchar(65530) character set utf8);
685.4.4 by Jay Pipes
Re-enabled and fixed the mix2_myisam test.
1328
#show create table t1;
1329
#drop table t1;
1330
#
1331
#eval set storage_engine=$default;
1332
#
1 by brian
clean slate
1333
# InnoDB specific varchar tests
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1334
#eval create $temp table t1 (v varchar(16384)) engine=$engine_type;
685.4.4 by Jay Pipes
Re-enabled and fixed the mix2_myisam test.
1335
#drop table t1;
1 by brian
clean slate
1336
1337
#
1338
# BUG#11039 Wrong key length in min()
1339
#
1340
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1341
eval create $temp table t1 (a char(1), b char(1), key(a, b)) engine=$engine_type;
1 by brian
clean slate
1342
insert into t1 values ('8', '6'), ('4', '7');
1343
select min(a) from t1;
1344
select min(b) from t1 where a='8';
1345
drop table t1;
1346
1347
#
1348
# Bug #11080 & #11005  Multi-row REPLACE fails on a duplicate key error
1349
#
1350
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1351
eval create $temp table t1 ( `a` int NOT NULL auto_increment, `b` int default NULL,PRIMARY KEY  (`a`),UNIQUE KEY `b` (`b`)) ENGINE=$engine_type;
1 by brian
clean slate
1352
insert into t1 (b) values (1);
1353
replace into t1 (b) values (2), (1), (3);
1354
select * from t1;
1355
truncate table t1;
1356
insert into t1 (b) values (1);
1357
replace into t1 (b) values (2);
1358
replace into t1 (b) values (1);
1359
replace into t1 (b) values (3);
1360
select * from t1;
1361
drop table t1;
1362
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1363
eval create $temp table t1 (rowid int not null auto_increment, val int not null,primary
1 by brian
clean slate
1364
key (rowid), unique(val)) engine=$engine_type;
1365
replace into t1 (val) values ('1'),('2');
1366
replace into t1 (val) values ('1'),('2');
1367
--error ER_DUP_ENTRY
1368
insert into t1 (val) values ('1'),('2');
1369
select * from t1;
1370
drop table t1;
1371
1372
if ($no_autoinc_update)
1373
{
1374
#
1375
# Test that update does not change internal auto-increment value
1376
#
1377
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1378
eval create $temp table t1 (a int not null auto_increment primary key, val int) engine=$engine_type;
1 by brian
clean slate
1379
insert into t1 (val) values (1);
1380
update t1 set a=2 where a=1;
1381
# We should get the following error because InnoDB does not update the counter
1382
--error ER_DUP_ENTRY
1383
insert into t1 (val) values (1);
1384
select * from t1;
1385
drop table t1;
1386
}
1387
1388
1389
#
1390
# Bug#10465: DECIMAL, crash on DELETE (InnoDB only)
1391
#
1392
1393
--disable_warnings
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1394
eval create $temp table t1 (GRADE DECIMAL(4) NOT NULL, PRIMARY KEY (GRADE)) ENGINE=$engine_type;
1 by brian
clean slate
1395
--enable_warnings
1396
INSERT INTO t1 (GRADE) VALUES (151),(252),(343);
1397
SELECT GRADE  FROM t1 WHERE GRADE > 160 AND GRADE < 300;
1398
SELECT GRADE  FROM t1 WHERE GRADE= 151;
1399
DROP TABLE t1;
1400
1401
if ($test_foreign_keys)
1402
{
1403
#
1404
# Test that the slow TRUNCATE implementation resets autoincrement columns
1405
# (bug #11946)
1406
#
1407
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1408
eval create $temp table t1 (
1 by brian
clean slate
1409
id INTEGER NOT NULL AUTO_INCREMENT, PRIMARY KEY (id)
1410
) ENGINE=$engine_type;
1411
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1412
eval create $temp table t2 (
1 by brian
clean slate
1413
id INTEGER NOT NULL,
1414
FOREIGN KEY (id) REFERENCES t1 (id)
1415
) ENGINE=$engine_type;
1416
1417
INSERT INTO t1 (id) VALUES (NULL);
1418
SELECT * FROM t1;
1419
TRUNCATE t1;
1420
INSERT INTO t1 (id) VALUES (NULL);
1421
SELECT * FROM t1;
1422
1423
# continued from above; test that doing a slow TRUNCATE on a table with 0
1424
# rows resets autoincrement columns
1425
DELETE FROM t1;
1426
TRUNCATE t1;
1427
INSERT INTO t1 (id) VALUES (NULL);
1428
SELECT * FROM t1;
1429
DROP TABLE t2, t1;
1430
1431
# Test that foreign keys in temporary tables are not accepted (bug #12084)
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1432
eval create $temp table t1
1 by brian
clean slate
1433
(
1434
 id INT PRIMARY KEY
1435
) ENGINE=$engine_type;
1436
1437
--error 1005,1005
1438
eval CREATE TEMPORARY TABLE t2
1439
(
1440
 id INT NOT NULL PRIMARY KEY,
1441
 b INT,
1442
 FOREIGN KEY (b) REFERENCES test.t1(id)
1443
) ENGINE=$engine_type;
1444
DROP TABLE t1;
1445
}
1446
# End of FOREIGN KEY test
1447
1448
# Please do not remove the following skipped InnoDB specific tests.
1449
# They make the synchronization with innodb.test easier and give
1450
# an idea what to test on other storage engines.
1451
if (0)
1452
{
1453
1454
#
1455
# Test that index column max sizes are honored (bug #13315)
1456
#
1457
1458
# prefix index
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1459
eval create $temp table t1 (col1 varchar(2000), index (col1(767)))
1 by brian
clean slate
1460
 character set = latin1 engine = $engine_type;
1461
1462
# normal indexes
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1463
eval create $temp table t2 (col1 char(255), index (col1))
1464
 character set = latin1 engine = $engine_type;
1465
eval create $temp table t3 (col1 binary(255), index (col1))
1466
 character set = latin1 engine = $engine_type;
1467
eval create $temp table t4 (col1 varchar(767), index (col1))
1468
 character set = latin1 engine = $engine_type;
1469
eval create $temp table t5 (col1 varchar(767) primary key)
1470
 character set = latin1 engine = $engine_type;
1471
eval create $temp table t6 (col1 varbinary(767) primary key)
1472
 character set = latin1 engine = $engine_type;
1473
eval create $temp table t7 (col1 text, index(col1(767)))
1474
 character set = latin1 engine = $engine_type;
1475
eval create $temp table t8 (col1 blob, index(col1(767)))
1 by brian
clean slate
1476
 character set = latin1 engine = $engine_type;
1477
1478
1479
# multi-column indexes are allowed to be longer
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1480
eval create $temp table t9 (col1 varchar(512), col2 varchar(512), index(col1, col2))
1 by brian
clean slate
1481
 character set = latin1 engine = $engine_type;
1482
1483
show create table t9;
1484
1485
drop table t1, t2, t3, t4, t5, t6, t7, t8, t9;
1486
1487
# these should have their index length trimmed
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1488
eval create $temp table t1 (col1 varchar(768), index(col1))
1489
 character set = latin1 engine = $engine_type;
1490
eval create $temp table t2 (col1 varbinary(768), index(col1))
1491
 character set = latin1 engine = $engine_type;
1492
eval create $temp table t3 (col1 text, index(col1(768)))
1493
 character set = latin1 engine = $engine_type;
1494
eval create $temp table t4 (col1 blob, index(col1(768)))
1 by brian
clean slate
1495
 character set = latin1 engine = $engine_type;
1496
1497
show create table t1;
1498
1499
drop table t1, t2, t3, t4;
1500
1501
}
1502
# End of skipped test
1503
1504
# Please do not remove the following skipped InnoDB specific tests.
1505
# They make the synchronization with innodb.test easier and give
1506
# an idea what to test on other storage engines.
1507
if (0)
1508
{
1509
1510
# these should be refused
1511
--error 1071
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1512
eval create $temp table t1 (col1 varchar(768) primary key)
1513
 character set = latin1 engine = $engine_type;
1514
--error 1071
1515
eval create $temp table t2 (col1 varbinary(768) primary key)
1516
 character set = latin1 engine = $engine_type;
1517
--error 1071
1518
eval create $temp table t3 (col1 text, primary key(col1(768)))
1519
 character set = latin1 engine = $engine_type;
1520
--error 1071
1521
eval create $temp table t4 (col1 blob, primary key(col1(768)))
1 by brian
clean slate
1522
 character set = latin1 engine = $engine_type;
1523
1524
}
1525
1526
if ($test_foreign_keys)
1527
{
1528
#
1529
# Test improved foreign key error messages (bug #3443)
1530
#
1531
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1532
eval create $temp table t1
1 by brian
clean slate
1533
(
1534
 id INT PRIMARY KEY
1535
) ENGINE=$engine_type;
1536
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1537
eval create $temp table t2
1 by brian
clean slate
1538
(
1539
 v INT,
1540
 CONSTRAINT c1 FOREIGN KEY (v) REFERENCES t1(id)
1541
) ENGINE=$engine_type;
1542
1543
--error 1452
1544
INSERT INTO t2 VALUES(2);
1545
1546
INSERT INTO t1 VALUES(1);
1547
INSERT INTO t2 VALUES(1);
1548
1549
--error 1451
1550
DELETE FROM t1 WHERE id = 1;
1551
1552
--error 1217
1553
DROP TABLE t1;
1554
1555
SET FOREIGN_KEY_CHECKS=0;
1556
DROP TABLE t1;
1557
SET FOREIGN_KEY_CHECKS=1;
1558
1559
--error 1452
1560
INSERT INTO t2 VALUES(3);
1561
1562
DROP TABLE t2;
1563
}
1564
# End of FOREIGN tests
1565
1566
if ($test_transactions)
1567
{
1568
#
1569
# Test that checksum table uses a consistent read Bug #12669
1570
#
1571
connect (a,localhost,root,,);
1572
connect (b,localhost,root,,);
1573
connection a;
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1574
eval create $temp table t1(a int not null) engine=$engine_type DEFAULT CHARSET=latin1;
1 by brian
clean slate
1575
insert into t1 values (1),(2);
1576
set autocommit=0;
1577
checksum table t1;
1578
connection b;
1579
insert into t1 values(3);
1580
connection a;
1581
#
1582
# Here checksum should not see insert
1583
#
1584
checksum table t1;
1585
connection a;
1586
commit;
1587
checksum table t1;
1588
commit;
1589
drop table t1;
1590
#
1591
# autocommit = 1
1592
#
1593
connection a;
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1594
eval create $temp table t1(a int not null) engine=$engine_type DEFAULT CHARSET=latin1;
1 by brian
clean slate
1595
insert into t1 values (1),(2);
1596
set autocommit=1;
1597
checksum table t1;
1598
connection b;
1599
set autocommit=1;
1600
insert into t1 values(3);
1601
connection a;
1602
#
1603
# Here checksum sees insert
1604
#
1605
checksum table t1;
1606
drop table t1;
1607
1608
connection default;
1609
disconnect a;
1610
disconnect b;
1611
}
1612
1613
# tests for bugs #9802 and #13778
1614
1615
if ($test_foreign_keys)
1616
{
1617
# test that FKs between invalid types are not accepted
1618
1619
set foreign_key_checks=0;
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1620
eval create $temp table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = $engine_type;
1 by brian
clean slate
1621
--replace_result $MYSQLTEST_VARDIR . master-data/ ''
1622
-- error 1005
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1623
eval create $temp table t1(a char(10) primary key, b varchar(20)) engine = $engine_type;
1 by brian
clean slate
1624
set foreign_key_checks=1;
1625
drop table t2;
1626
1627
# test that FKs between different charsets are not accepted in CREATE even
1628
# when f_k_c is 0
1629
1630
set foreign_key_checks=0;
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1631
eval create $temp table t1(a varchar(10) primary key) engine = $engine_type DEFAULT CHARSET=latin1;
1 by brian
clean slate
1632
--replace_result $MYSQLTEST_VARDIR . master-data/ ''
1633
-- error 1005
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1634
eval create $temp table t2 (a varchar(10), foreign key (a) references t1(a)) engine = $engine_type DEFAULT CHARSET=utf8;
1 by brian
clean slate
1635
set foreign_key_checks=1;
1636
drop table t1;
1637
1638
# test that invalid datatype conversions with ALTER are not allowed
1639
1640
set foreign_key_checks=0;
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1641
eval create $temp table t2 (a varchar(10), foreign key (a) references t1(a)) engine = $engine_type;
1642
eval create $temp table t1(a varchar(10) primary key) engine = $engine_type;
1 by brian
clean slate
1643
-- error 1025,1025
1644
alter table t1 modify column a int;
1645
set foreign_key_checks=1;
1646
drop table t2,t1;
1647
1648
# test that charset conversions with ALTER are allowed when f_k_c is 0
1649
1650
set foreign_key_checks=0;
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1651
eval create $temp table t2 (a varchar(10), foreign key (a) references t1(a)) engine = $engine_type DEFAULT CHARSET=latin1;
1652
eval create $temp table t1(a varchar(10) primary key) engine = $engine_type DEFAULT CHARSET=latin1;
1 by brian
clean slate
1653
alter table t1 convert to character set utf8;
1654
set foreign_key_checks=1;
1655
drop table t2,t1;
1656
1657
# test that RENAME does not allow invalid charsets when f_k_c is 0
1658
1659
set foreign_key_checks=0;
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1660
eval create $temp table t2 (a varchar(10), foreign key (a) references t1(a)) engine = $engine_type DEFAULT CHARSET=latin1;
1661
eval create $temp table t3(a varchar(10) primary key) engine = $engine_type DEFAULT CHARSET=utf8;
1 by brian
clean slate
1662
--replace_result $MYSQLTEST_VARDIR . master-data/ ''
1663
-- error 1025
1664
rename table t3 to t1;
1665
set foreign_key_checks=1;
1666
drop table t2,t3;
1667
1668
# test that foreign key errors are reported correctly (Bug #15550)
1669
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1670
eval create $temp table t1(a int primary key) row_format=redundant engine=$engine_type;
1671
eval create $temp table t2(a int primary key,constraint foreign key(a)references t1(a)) row_format=compact engine=$engine_type;
1672
eval create $temp table t3(a int primary key) row_format=compact engine=$engine_type;
1673
eval create $temp table t4(a int primary key,constraint foreign key(a)references t3(a)) row_format=redundant engine=$engine_type;
1 by brian
clean slate
1674
1675
insert into t1 values(1);
1676
insert into t3 values(1);
1677
-- error 1452
1678
insert into t2 values(2);
1679
-- error 1452
1680
insert into t4 values(2);
1681
insert into t2 values(1);
1682
insert into t4 values(1);
1683
-- error 1451
1684
update t1 set a=2;
1685
-- error 1452
1686
update t2 set a=2;
1687
-- error 1451
1688
update t3 set a=2;
1689
-- error 1452
1690
update t4 set a=2;
1691
-- error 1451
1692
truncate t1;
1693
-- error 1451
1694
truncate t3;
1695
truncate t2;
1696
truncate t4;
1697
truncate t1;
1698
truncate t3;
1699
1700
drop table t4,t3,t2,t1;
1701
}
1702
# End of FOREIGN KEY tests
1703
1704
1705
# Please do not remove the following skipped InnoDB specific tests.
1706
# They make the synchronization with innodb.test easier and give
1707
# an idea what to test on other storage engines.
1708
if (0)
1709
{
1710
1711
#
1712
# Test that we can create a large (>1K) key
1713
#
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1714
eval create $temp table t1 (a varchar(255) character set utf8,
1 by brian
clean slate
1715
                 b varchar(255) character set utf8,
1716
                 c varchar(255) character set utf8,
1717
                 d varchar(255) character set utf8,
1718
                 key (a,b,c,d)) engine=$engine_type;
1719
drop table t1;
1720
--error ER_TOO_LONG_KEY
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1721
eval create $temp table t1 (a varchar(255) character set utf8,
1 by brian
clean slate
1722
                 b varchar(255) character set utf8,
1723
                 c varchar(255) character set utf8,
1724
                 d varchar(255) character set utf8,
1725
                 e varchar(255) character set utf8,
1726
                 key (a,b,c,d,e)) engine=$engine_type;
1727
1728
1729
# test the padding of BINARY types and collations (Bug #14189)
1730
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1731
eval create $temp table t1 (s1 varbinary(2),primary key (s1)) engine=$engine_type;
1732
eval create $temp table t2 (s1 binary(2),primary key (s1)) engine=$engine_type;
1217 by Brian Aker
Removed bits of charset support from the parser.
1733
eval create $temp table t3 (s1 varchar(2),primary key (s1)) engine=$engine_type;
1734
eval create $temp table t4 (s1 char(2),primary key (s1)) engine=$engine_type;
1 by brian
clean slate
1735
1736
insert into t1 values (0x41),(0x4120),(0x4100);
1737
-- error ER_DUP_ENTRY
1738
insert into t2 values (0x41),(0x4120),(0x4100);
1739
insert into t2 values (0x41),(0x4120);
1740
-- error ER_DUP_ENTRY
1741
insert into t3 values (0x41),(0x4120),(0x4100);
1742
insert into t3 values (0x41),(0x4100);
1743
-- error ER_DUP_ENTRY
1744
insert into t4 values (0x41),(0x4120),(0x4100);
1745
insert into t4 values (0x41),(0x4100);
1746
select hex(s1) from t1;
1747
select hex(s1) from t2;
1748
select hex(s1) from t3;
1749
select hex(s1) from t4;
1750
drop table t1,t2,t3,t4;
1751
}
1752
1753
if (test_foreign_keys)
1754
{
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1755
eval create $temp table t1 (a int primary key,s1 varbinary(3) not null unique) engine=$engine_type;
1756
eval create $temp table t2 (s1 binary(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=$engine_type;
1 by brian
clean slate
1757
1758
insert into t1 values(1,0x4100),(2,0x41),(3,0x4120),(4,0x42);
1759
-- error 1452
1760
insert into t2 values(0x42);
1761
insert into t2 values(0x41);
1762
select hex(s1) from t2;
1763
update t1 set s1=0x123456 where a=2;
1764
select hex(s1) from t2;
1765
-- error 1451
1766
update t1 set s1=0x12 where a=1;
1767
-- error 1451
1768
update t1 set s1=0x12345678 where a=1;
1769
-- error 1451
1770
update t1 set s1=0x123457 where a=1;
1771
update t1 set s1=0x1220 where a=1;
1772
select hex(s1) from t2;
1773
update t1 set s1=0x1200 where a=1;
1774
select hex(s1) from t2;
1775
update t1 set s1=0x4200 where a=1;
1776
select hex(s1) from t2;
1777
-- error 1451
1778
delete from t1 where a=1;
1779
delete from t1 where a=2;
1780
update t2 set s1=0x4120;
1781
-- error 1451
1782
delete from t1;
1783
delete from t1 where a!=3;
1784
select a,hex(s1) from t1;
1785
select hex(s1) from t2;
1786
1787
drop table t2,t1;
1788
1217 by Brian Aker
Removed bits of charset support from the parser.
1789
eval create $temp table t1 (a int primary key,s1 varchar(2) not null unique) engine=$engine_type;
1790
eval create $temp table t2 (s1 char(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=$engine_type;
1 by brian
clean slate
1791
1792
insert into t1 values(1,0x4100),(2,0x41);
1793
insert into t2 values(0x41);
1794
select hex(s1) from t2;
1795
update t1 set s1=0x1234 where a=1;
1796
select hex(s1) from t2;
1797
update t1 set s1=0x12 where a=2;
1798
select hex(s1) from t2;
1799
delete from t1 where a=1;
1800
-- error 1451
1801
delete from t1 where a=2;
1802
select a,hex(s1) from t1;
1803
select hex(s1) from t2;
1804
1805
drop table t2,t1;
1806
}
1807
# End FOREIGN KEY tests
1808
1809
if ($test_foreign_keys)
1810
{
1811
# Ensure that <tablename>_ibfk_0 is not mistreated as a
1812
# generated foreign key identifier.  (Bug #16387)
1813
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1814
eval create $temp table t1(a INT, PRIMARY KEY(a)) ENGINE=$engine_type;
1815
eval create $temp table t2(a INT) ENGINE=$engine_type;
1 by brian
clean slate
1816
ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1(a);
1817
ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_1;
1818
ALTER TABLE t2 ADD CONSTRAINT t2_ibfk_0 FOREIGN KEY (a) REFERENCES t1(a);
1819
ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_0;
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1820
SHOW create $temp table t2;
1 by brian
clean slate
1821
DROP TABLE t2,t1;
1822
}
1823
1824
if ($test_foreign_keys)
1825
{
1826
#
1827
# Test that cascading updates leading to duplicate keys give the correct
1828
# error message (bug #9680)
1829
#
1830
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1831
eval create $temp table t1 (
1 by brian
clean slate
1832
  field1 varchar(8) NOT NULL DEFAULT '',
1833
  field2 varchar(8) NOT NULL DEFAULT '',
1834
  PRIMARY KEY  (field1, field2)
1835
) ENGINE=$engine_type;
1836
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1837
eval create $temp table t2 (
1 by brian
clean slate
1838
  field1 varchar(8) NOT NULL DEFAULT '' PRIMARY KEY,
1839
  FOREIGN KEY (field1) REFERENCES t1 (field1)
1840
    ON DELETE CASCADE ON UPDATE CASCADE
1841
) ENGINE=$engine_type;
1842
1843
INSERT INTO t1 VALUES ('old', 'somevalu');
1844
INSERT INTO t1 VALUES ('other', 'anyvalue');
1845
1846
INSERT INTO t2 VALUES ('old');
1847
INSERT INTO t2 VALUES ('other');
1848
1849
--error ER_FOREIGN_DUPLICATE_KEY
1850
UPDATE t1 SET field1 = 'other' WHERE field2 = 'somevalu';
1851
1852
DROP TABLE t2;
1853
DROP TABLE t1;
1854
1855
#
1856
# Bug#18477 - MySQL/InnoDB Ignoring Foreign Keys in ALTER TABLE
1857
#
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1858
eval create $temp table t1 (
1 by brian
clean slate
1859
  c1 bigint not null,
1860
  c2 bigint not null,
1861
  primary key (c1),
1862
  unique  key (c2)
1863
) engine=$engine_type;
1864
#
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1865
eval create $temp table t2 (
1 by brian
clean slate
1866
  c1 bigint not null,
1867
  primary key (c1)
1868
) engine=$engine_type;
1869
#
1870
alter table t1 add constraint c2_fk foreign key (c2)
1871
  references t2(c1) on delete cascade;
1872
show create table t1;
1873
#
1874
alter table t1 drop foreign key c2_fk;
1875
show create table t1;
1876
#
1877
drop table t1, t2;
1878
}
1879
# End FOREIGN KEY test
1880
1881
#
1882
# Bug #14360: problem with intervals
1883
#
1884
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1885
eval create $temp table t1(a date) engine=$engine_type;
1886
eval create $temp table t2(a date, key(a)) engine=$engine_type;
1 by brian
clean slate
1887
insert into t1 values('2005-10-01');
1888
insert into t2 values('2005-10-01');
1889
select * from t1, t2
1890
  where t2.a between t1.a - interval 2 day and t1.a + interval 2 day;
1891
drop table t1, t2;
1892
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1893
eval create $temp table t1 (id int not null, f_id int not null, f int not null,
1 by brian
clean slate
1894
primary key(f_id, id)) engine=$engine_type;
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1895
eval create $temp table t2 (id int not null,s_id int not null,s varchar(200),
1 by brian
clean slate
1896
primary key(id)) engine=$engine_type;
1897
INSERT INTO t1 VALUES (8, 1, 3);
1898
INSERT INTO t1 VALUES (1, 2, 1);
1899
INSERT INTO t2 VALUES (1, 0, '');
1900
INSERT INTO t2 VALUES (8, 1, '');
1901
commit;
1902
select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id)
1903
where mm.id is null lock in share mode;
1904
drop table t1,t2;
1905
1906
#
1907
# Test case where X-locks on unused rows should be released in a
1908
# update (because READ COMMITTED isolation level)
1909
#
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1910
if(!$using_temp)
1911
{
1 by brian
clean slate
1912
connect (a,localhost,root,,);
1913
connect (b,localhost,root,,);
1914
connection a;
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1915
eval create $temp table t1(a int not null, b int, primary key(a)) engine=$engine_type;
1 by brian
clean slate
1916
insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
1917
commit;
1918
set autocommit = 0;
1919
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
1920
update t1 set b = 5 where b = 1;
1921
connection b;
1922
set autocommit = 0;
1923
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
1924
#
1925
# X-lock to record (7,3) should be released in a update
1926
#
1927
select * from t1 where a = 7 and b = 3 for update;
1928
connection a;
1929
commit;
1930
connection b;
1931
commit;
1932
drop table t1;
1933
connection default;
1934
disconnect a;
1935
disconnect b;
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1936
}
1 by brian
clean slate
1937
if ($test_transactions)
1938
{
1939
#
1940
# Test case where no locks should be released (because we are not
1941
# using READ COMMITTED isolation level)
1942
#
1943
1944
connect (a,localhost,root,,);
1945
connect (b,localhost,root,,);
1946
connection a;
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1947
eval create $temp table t1(a int not null, b int, primary key(a)) engine=$engine_type;
1 by brian
clean slate
1948
insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2);
1949
commit;
1950
set autocommit = 0;
1951
select * from t1 lock in share mode;
1952
update t1 set b = 5 where b = 1;
1953
connection b;
1954
set autocommit = 0;
1955
#
1956
# S-lock to records (2,2),(4,2), and (6,2) should not be released in a update
1957
#
1958
--error 1205
1959
select * from t1 where a = 2 and b = 2 for update;
1960
#
1961
# X-lock to record (1,1),(3,1),(5,1) should not be released in a update
1962
#
1963
--error 1205
1964
connection a;
1965
commit;
1966
connection b;
1967
commit;
1968
connection default;
1969
disconnect a;
1970
disconnect b;
1971
drop table t1;
1972
1973
#
1974
# Consistent read should be used in following selects
1975
#
1976
# 1) INSERT INTO ... SELECT
1977
# 2) UPDATE ... = ( SELECT ...)
1978
# 3) CREATE ... SELECT
1979
1980
connect (a,localhost,root,,);
1981
connect (b,localhost,root,,);
1982
connection a;
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1983
eval create $temp table t1(a int not null, b int, primary key(a)) engine=$engine_type;
1 by brian
clean slate
1984
insert into t1 values (1,2),(5,3),(4,2);
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1985
eval create $temp table t2(d int not null, e int, primary key(d)) engine=$engine_type;
1 by brian
clean slate
1986
insert into t2 values (8,6),(12,1),(3,1);
1987
commit;
1988
set autocommit = 0;
1989
select * from t2 for update;
1990
connection b;
1991
set autocommit = 0;
1992
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
1993
insert into t1 select * from t2;
1994
update t1 set b = (select e from t2 where a = d);
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
1995
eval create $temp table t3(d int not null, e int, primary key(d)) engine=$engine_type
1 by brian
clean slate
1996
select * from t2;
1997
commit;
1998
connection a;
1999
commit;
2000
connection default;
2001
disconnect a;
2002
disconnect b;
2003
drop table t1, t2, t3;
2004
2005
#
2006
# Consistent read should not be used if
2007
#
2008
# (a) isolation level is serializable OR
2009
# (b) select ... lock in share mode OR
2010
# (c) select ... for update
2011
#
2012
# in following queries:
2013
#
2014
# 1) INSERT INTO ... SELECT
2015
# 2) UPDATE ... = ( SELECT ...)
2016
# 3) CREATE ... SELECT
2017
2018
connect (a,localhost,root,,);
2019
eval SET SESSION STORAGE_ENGINE = $engine_type;
2020
connect (b,localhost,root,,);
2021
eval SET SESSION STORAGE_ENGINE = $engine_type;
2022
connect (c,localhost,root,,);
2023
eval SET SESSION STORAGE_ENGINE = $engine_type;
2024
connect (d,localhost,root,,);
2025
eval SET SESSION STORAGE_ENGINE = $engine_type;
2026
connect (e,localhost,root,,);
2027
eval SET SESSION STORAGE_ENGINE = $engine_type;
2028
connect (f,localhost,root,,);
2029
eval SET SESSION STORAGE_ENGINE = $engine_type;
2030
connect (g,localhost,root,,);
2031
eval SET SESSION STORAGE_ENGINE = $engine_type;
2032
connect (h,localhost,root,,);
2033
eval SET SESSION STORAGE_ENGINE = $engine_type;
2034
connect (i,localhost,root,,);
2035
eval SET SESSION STORAGE_ENGINE = $engine_type;
2036
connect (j,localhost,root,,);
2037
eval SET SESSION STORAGE_ENGINE = $engine_type;
2038
connection a;
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
2039
create $temp table t1(a int not null, b int, primary key(a));
1 by brian
clean slate
2040
insert into t1 values (1,2),(5,3),(4,2);
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
2041
create $temp table t2(a int not null, b int, primary key(a));
1 by brian
clean slate
2042
insert into t2 values (8,6),(12,1),(3,1);
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
2043
create $temp table t3(d int not null, b int, primary key(d));
1 by brian
clean slate
2044
insert into t3 values (8,6),(12,1),(3,1);
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
2045
create $temp table t5(a int not null, b int, primary key(a));
1 by brian
clean slate
2046
insert into t5 values (1,2),(5,3),(4,2);
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
2047
create $temp table t6(d int not null, e int, primary key(d));
1 by brian
clean slate
2048
insert into t6 values (8,6),(12,1),(3,1);
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
2049
create $temp table t8(a int not null, b int, primary key(a));
1 by brian
clean slate
2050
insert into t8 values (1,2),(5,3),(4,2);
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
2051
create $temp table t9(d int not null, e int, primary key(d));
1 by brian
clean slate
2052
insert into t9 values (8,6),(12,1),(3,1);
2053
commit;
2054
set autocommit = 0;
2055
select * from t2 for update;
2056
connection b;
2057
set autocommit = 0;
2058
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
2059
--send
2060
insert into t1 select * from t2;
2061
connection c;
2062
set autocommit = 0;
2063
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
2064
--send
2065
update t3 set b = (select b from t2 where a = d);
2066
connection d;
2067
set autocommit = 0;
2068
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
2069
--send
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
2070
create $temp table t4(a int not null, b int, primary key(a)) select * from t2;
1 by brian
clean slate
2071
connection e;
2072
set autocommit = 0;
2073
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
2074
--send
2075
insert into t5 (select * from t2 lock in share mode);
2076
connection f;
2077
set autocommit = 0;
2078
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
2079
--send
2080
update t6 set e = (select b from t2 where a = d lock in share mode);
2081
connection g;
2082
set autocommit = 0;
2083
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
2084
--send
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
2085
create $temp table t7(a int not null, b int, primary key(a)) select * from t2 lock in share mode;
1 by brian
clean slate
2086
connection h;
2087
set autocommit = 0;
2088
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
2089
--send
2090
insert into t8 (select * from t2 for update);
2091
connection i;
2092
set autocommit = 0;
2093
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
2094
--send
2095
update t9 set e = (select b from t2 where a = d for update);
2096
connection j;
2097
set autocommit = 0;
2098
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
2099
--send
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
2100
create $temp table t10(a int not null, b int, primary key(a)) select * from t2 for update;
1 by brian
clean slate
2101
2102
connection b;
2103
--error 1205
2104
reap;
2105
2106
connection c;
2107
--error 1205
2108
reap;
2109
2110
connection d;
2111
--error 1205
2112
reap;
2113
2114
connection e;
2115
--error 1205
2116
reap;
2117
2118
connection f;
2119
--error 1205
2120
reap;
2121
2122
connection g;
2123
--error 1205
2124
reap;
2125
2126
connection h;
2127
--error 1205
2128
reap;
2129
2130
connection i;
2131
--error 1205
2132
reap;
2133
2134
connection j;
2135
--error 1205
2136
reap;
2137
2138
connection a;
2139
commit;
2140
2141
connection default;
2142
disconnect a;
2143
disconnect b;
2144
disconnect c;
2145
disconnect d;
2146
disconnect e;
2147
disconnect f;
2148
disconnect g;
2149
disconnect h;
2150
disconnect i;
2151
disconnect j;
2152
drop table t1, t2, t3, t5, t6, t8, t9;
2153
}
2154
# End transactional tests
2155
2156
if (test_foreign_keys)
2157
{
2158
# bug 18934, "InnoDB crashes when table uses column names like DB_ROW_ID"
2159
--error 1005
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
2160
eval create $temp table t1 (DB_ROW_ID int) engine=$engine_type;
1 by brian
clean slate
2161
2162
#
2163
# Bug #17152: Wrong result with BINARY comparison on aliased column
2164
#
2165
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
2166
eval create $temp table t1 (
1 by brian
clean slate
2167
   a BIGINT(20) NOT NULL,
2168
    PRIMARY KEY  (a)
2169
 ) ENGINE=$engine_type DEFAULT CHARSET=UTF8;
2170
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
2171
eval create $temp table t2 (
1 by brian
clean slate
2172
  a BIGINT(20) NOT NULL,
2173
  b VARCHAR(128) NOT NULL,
2174
  c TEXT NOT NULL,
2175
  PRIMARY KEY  (a,b),
2176
  KEY idx_t2_b_c (b,c(200)),
2177
  CONSTRAINT t_fk FOREIGN KEY (a) REFERENCES t1 (a)
2178
   ON DELETE CASCADE
2179
 ) ENGINE=$engine_type DEFAULT CHARSET=UTF8;
2180
2181
INSERT INTO t1 VALUES (1);
2182
INSERT INTO t2 VALUES (1, 'bar', 'vbar');
2183
INSERT INTO t2 VALUES (1, 'BAR2', 'VBAR');
2184
INSERT INTO t2 VALUES (1, 'bar_bar', 'bibi');
2185
INSERT INTO t2 VALUES (1, 'customer_over', '1');
2186
2187
SELECT * FROM t2 WHERE b = 'customer_over';
2188
SELECT * FROM t2 WHERE BINARY b = 'customer_over';
2189
SELECT DISTINCT p0.a FROM t2 p0 WHERE p0.b = 'customer_over';
2190
/* Bang: Empty result set, above was expected: */
2191
SELECT DISTINCT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
2192
SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
2193
2194
drop table t2, t1;
2195
}
2196
2197
if ($no_spatial_key)
2198
{
2199
#
2200
# Bug #15680 (SPATIAL key in innodb)
2201
#
2202
--error ER_TABLE_CANT_HANDLE_SPKEYS
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
2203
eval create $temp table t1 (g geometry not null, spatial gk(g)) engine=$engine_type;
1 by brian
clean slate
2204
}
2205
2206
#
2207
# Test optimize on table with open transaction
2208
#
2209
1063.9.13 by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit.
2210
eval create $temp table t1 ( a int ) ENGINE=$engine_type;
1 by brian
clean slate
2211
BEGIN;
2212
INSERT INTO t1 VALUES (1);
2213
OPTIMIZE TABLE t1;
2214
DROP TABLE t1;
2215
2216
#######################################################################
2217
#                                                                     #
2218
# This is derivate of t/innodb.test and has to be maintained by       #
2219
# MySQL guys only.                                                    #
2220
#                                                                     #
2221
# Please synchronize this file from time to time with t/innodb.test.  #
2222
# Please, DO NOT create a toplevel testcase innodb-mix2.test, because #
2223
# innodb.test does already these tests.                               #
2224
#                                                                     #
2225
#######################################################################