~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;
2137.2.1 by kalebral at gmail
Remove last remaining error numbers from tests, only use enum values
99
--error ER_DUP_ENTRY,  ER_DUP_KEY
1 by brian
clean slate
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;
1222.1.14 by Brian Aker
Remove OPTIMIZE, place in ALTER TABLE (which does the same thing).
114
eval alter table t1 engine=$engine_type;
1 by brian
clean slate
115
--replace_column 7 #
1273.19.2 by Brian Aker
First pass through show indexs.
116
#show keys from t1;
1 by brian
clean slate
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);
1222.1.14 by Brian Aker
Remove OPTIMIZE, place in ALTER TABLE (which does the same thing).
141
eval alter table t1 ENGINE=$engine_type;
1 by brian
clean slate
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 #
1273.19.2 by Brian Aker
First pass through show indexs.
155
#show keys from t1;
1 by brian
clean slate
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);
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
182
--error ER_DUP_ENTRY
1 by brian
clean slate
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);
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
188
--error ER_DUP_ENTRY
1 by brian
clean slate
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;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
203
--error ER_SP_DOES_NOT_EXIST
1 by brian
clean slate
204
rollback to savepoint savept3;
205
rollback to savepoint savept2;
206
release savepoint `my_savepoint`;
207
select n from t1;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
208
--error ER_SP_DOES_NOT_EXIST
1 by brian
clean slate
209
rollback to savepoint `my_savepoint`;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
210
--error ER_SP_DOES_NOT_EXIST
1 by brian
clean slate
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);
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
262
--error ER_DUP_ENTRY
1 by brian
clean slate
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 #
1273.19.2 by Brian Aker
First pass through show indexs.
342
#show index from t1;
1 by brian
clean slate
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;
1976.6.1 by Brian Aker
This is a fix for bug lp:686197
355
alter table t1 add co3 int DEFAULT 42 not null;
1 by brian
clean slate
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');
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
393
--error ER_DUP_ENTRY
1 by brian
clean slate
394
insert into t1 (ggid,passwd) values ('test2','this will fail');
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
395
--error ER_DUP_ENTRY
1 by brian
clean slate
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');
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
404
--error ER_DUP_ENTRY
1 by brian
clean slate
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;
1222.1.14 by Brian Aker
Remove OPTIMIZE, place in ALTER TABLE (which does the same thing).
519
eval alter table t1 ENGINE=$engine_type;
1 by brian
clean slate
520
--replace_column 7 #
1273.19.2 by Brian Aker
First pass through show indexs.
521
#show keys from t1;
1 by brian
clean slate
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
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
628
--error ER_BAD_DB_ERROR
1 by brian
clean slate
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);
2140.2.6 by Stewart Smith
be sure to start a transaction with a startTransaction call on the first statement when autocommit is OFF. The only statements that DO NOT do this are a) DDL and b) SELECT without a table (e.g. SELECT DATABASE() and SHOW STATUS.
638
commit;
1 by brian
clean slate
639
truncate table t1;
640
commit;
641
truncate table t1;
642
truncate table t1;
643
select * from t1;
644
insert into t1 values(1),(2);
645
delete from t1;
646
select * from t1;
647
commit;
648
drop table t1;
649
set autocommit=1;
650
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.
651
eval create $temp table t1 (a int not null) engine= $engine_type;
1 by brian
clean slate
652
insert into t1 values(1),(2);
653
truncate table t1;
654
insert into t1 values(1),(2);
655
select * from t1;
656
truncate table t1;
657
insert into t1 values(1),(2);
658
delete from t1;
659
select * from t1;
660
drop table t1;
661
662
#
663
# Test of how ORDER BY works when doing it on the whole table
664
#
665
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.
666
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
667
insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
668
--replace_column 9 #
669
explain select * from t1 order by a;
670
--replace_column 9 #
671
explain select * from t1 order by b;
672
--replace_column 9 #
673
explain select * from t1 order by c;
674
--replace_column 9 #
675
explain select a from t1 order by a;
676
--replace_column 9 #
677
explain select b from t1 order by b;
678
--replace_column 9 #
679
explain select a,b from t1 order by b;
680
--replace_column 9 #
681
explain select a,b from t1;
682
--replace_column 9 #
683
explain select a,b,c from t1;
684
drop table t1;
685
686
#
687
# Check describe
688
#
689
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.
690
eval create $temp table t1 (t int not null default 1, key (t)) engine=$engine_type;
1273.19.4 by Brian Aker
Updates for DESC.
691
#desc t1;
1 by brian
clean slate
692
drop table t1;
693
694
#
695
# A simple test with some isolation levels
696
# TODO: Make this into a test using replication to really test how
697
# this works.
698
#
699
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.
700
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
701
702
BEGIN;
703
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
704
SELECT @@tx_isolation,@@global.tx_isolation;
705
insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David');
706
select id, code, name from t1 order by id;
707
COMMIT;
708
709
BEGIN;
710
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
711
insert into t1 (code, name) values (2, 'Erik'), (3, 'Sasha');
712
select id, code, name from t1 order by id;
713
COMMIT;
714
715
BEGIN;
716
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
717
insert into t1 (code, name) values (3, 'Jeremy'), (4, 'Matt');
718
select id, code, name from t1 order by id;
719
COMMIT;
720
DROP TABLE t1;
721
722
#
723
# Testing of IFNULL
724
#
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.
725
if(!$using_temp)
726
{
727
eval create $temp table t1 (a int, b int) engine=$engine_type;
1 by brian
clean slate
728
insert into t1 values(20,null);
729
select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
730
t2.b=t3.a;
731
select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
732
t2.b=t3.a order by 1;
733
insert into t1 values(10,null);
734
select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
735
t2.b=t3.a order by 1;
736
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.
737
}
1 by brian
clean slate
738
739
if ($test_foreign_keys)
740
{
741
#
742
# Test of multi-table-delete with foreign key constraints
743
#
744
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.
745
eval create $temp table t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=$engine_type;
746
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
747
insert into t1 set id=1;
748
insert into t2 set id=1, t1_id=1;
749
delete t1,t2 from t1,t2 where t1.id=t2.t1_id;
750
select * from t1;
751
select * from t2;
752
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.
753
eval create $temp table t1(id INT NOT NULL,  PRIMARY KEY (id)) ENGINE=$engine_type;
754
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
755
INSERT INTO t1 VALUES(1);
756
INSERT INTO t2 VALUES(1, 1);
757
SELECT * from t1;
758
UPDATE t1,t2 SET t1.id=t1.id+1, t2.t1_id=t1.id+1;
759
SELECT * from t1;
760
UPDATE t1,t2 SET t1.id=t1.id+1 where t1.id!=t2.id;
761
SELECT * from t1;
762
DROP TABLE t1,t2;
763
}
764
765
if ($test_transactions)
766
{
767
#
768
# Test of range_optimizer
769
#
770
771
set autocommit=0;
772
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.
773
eval create $temp table t1 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=$engine_type;
774
775
eval create $temp table t2 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=$engine_type;
776
777
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
778
779
INSERT INTO t3 VALUES("my-test-1", "my-test-2");
780
COMMIT;
781
782
INSERT INTO t1 VALUES("this-key", "will disappear");
783
INSERT INTO t2 VALUES("this-key", "will also disappear");
784
DELETE FROM t3 WHERE id1="my-test-1";
785
786
SELECT * FROM t1;
787
SELECT * FROM t2;
788
SELECT * FROM t3;
789
ROLLBACK;
790
791
SELECT * FROM t1;
792
SELECT * FROM t2;
793
SELECT * FROM t3;
794
SELECT * FROM t3 WHERE id1="my-test-1" LOCK IN SHARE MODE;
795
COMMIT;
796
set autocommit=1;
797
DROP TABLE t1,t2,t3;
798
}
799
800
#
801
# Check update with conflicting key
802
#
803
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.
804
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
805
INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
806
# We need the a < 1000 test here to quard against the halloween problems
807
UPDATE t1 set a=a+100 where b between 2 and 3 and a < 1000;
808
SELECT * from t1;
809
drop table t1;
810
811
#
812
# Test that MySQL priorities clustered indexes
813
#
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.
814
eval create $temp table t1 (a int not null auto_increment primary key, b int, c int, key(c)) engine=$engine_type;
815
eval create $temp table t2 (a int not null auto_increment primary key, b int) ENGINE = $other_engine_type;
1 by brian
clean slate
816
insert into t1 (b) values (null),(null),(null),(null),(null),(null),(null);
817
insert into t2 (a) select b from t1;
818
insert into t1 (b) select b from t2;
819
insert into t2 (a) select b from t1;
820
insert into t1 (a) select b from t2;
821
insert into t2 (a) select b from t1;
822
insert into t1 (a) select b from t2;
823
insert into t2 (a) select b from t1;
824
insert into t1 (a) select b from t2;
825
insert into t2 (a) select b from t1;
826
insert into t1 (a) select b from t2;
827
insert into t2 (a) select b from t1;
828
insert into t1 (a) select b from t2;
829
insert into t2 (a) select b from t1;
830
insert into t1 (a) select b from t2;
831
insert into t2 (a) select b from t1;
832
insert into t1 (a) select b from t2;
833
insert into t2 (a) select b from t1;
834
insert into t1 (a) select b from t2;
835
select count(*) from t1;
836
--replace_column 9 #
837
explain select * from t1 where c between 1 and 2500;
838
update t1 set c=a;
839
--replace_column 9 #
840
explain select * from t1 where c between 1 and 2500;
841
drop table t1,t2;
842
843
#
844
# Test of UPDATE ... ORDER BY
845
#
846
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.
847
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
848
849
insert into t1 (id) values (null),(null),(null),(null),(null);
850
update t1 set fk=69 where fk is null order by id limit 1;
851
SELECT * from t1;
852
drop table t1;
853
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.
854
eval create $temp table t1 (a int not null, b int not null, key (a)) engine=$engine_type;
1 by brian
clean slate
855
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);
856
SET @tmp=0;
857
update t1 set b=(@tmp:=@tmp+1) order by a;
858
update t1 set b=99 where a=1 order by b asc limit 1;
859
update t1 set b=100 where a=1 order by b desc limit 2;
860
update t1 set a=a+10+b where a=1 order by b;
861
select * from t1 order by a,b;
862
drop table t1;
863
864
#
865
# test autoincrement with TRUNCATE
866
#
867
868
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.
869
eval create $temp table t1 (a integer auto_increment primary key) engine=$engine_type;
1 by brian
clean slate
870
insert into t1 (a) values (NULL),(NULL);
871
truncate table t1;
872
insert into t1 (a) values (NULL),(NULL);
873
SELECT * from t1;
874
drop table t1;
875
876
877
if ($test_foreign_keys)
878
{
879
#
880
# Test dictionary handling with spaceand quoting
881
#
882
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.
883
eval create $temp table t1 (`id 1` INT NOT NULL, PRIMARY KEY (`id 1`)) ENGINE=$engine_type;
884
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
885
#show create table t2;
886
drop table t2,t1;
887
888
#
889
# Test of multi updated and foreign keys
890
#
891
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.
892
eval create $temp table `t1` (`id` int not null  ,primary key ( `id` )) engine = $engine_type;
1 by brian
clean slate
893
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.
894
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
895
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.
896
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
897
insert into `t3`values ( 1 ) ;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
898
--error ER_ROW_IS_REFERENCED_2
1 by brian
clean slate
899
delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
900
--error ER_ROW_IS_REFERENCED_2
1 by brian
clean slate
901
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;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
902
--error ER_BAD_FIELD_ERROR
1 by brian
clean slate
903
update t3 set  t3.id=7  where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
904
drop table t3,t2,t1;
905
906
#
907
# test for recursion depth limit
908
#
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.
909
eval create $temp table t1(
1 by brian
clean slate
910
	id int primary key,
911
	pid int,
912
	index(pid),
913
	foreign key(pid) references t1(id) on delete cascade) engine=$engine_type;
914
insert into t1 values(0,0),(1,0),(2,1),(3,2),(4,3),(5,4),(6,5),(7,6),
915
	(8,7),(9,8),(10,9),(11,10),(12,11),(13,12),(14,13),(15,14);
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
916
--error ER_ROW_IS_REFERENCED_2
1 by brian
clean slate
917
delete from t1 where id=0;
918
delete from t1 where id=15;
919
delete from t1 where id=0;
920
921
drop table t1;
922
}
923
# End of FOREIGN KEY tests
924
925
#
926
# Test timestamps
927
#
928
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.
929
eval create $temp table t1 (col1 int)ENGINE=$engine_type;
930
eval create $temp table t2 (col1 int,stamp TIMESTAMP,INDEX stamp_idx
1 by brian
clean slate
931
(stamp))ENGINE=$engine_type;
932
insert into t1 values (1),(2),(3);
2082.4.1 by Brian Aker
Merge in trunk.
933
insert into t2 values (1, 20020204130000);
934
insert into t2 values (2, 20020204130000);
935
--error ER_INVALID_TIMESTAMP_VALUE # Bad timestamp
936
insert into t2 values (4, 20020204310000);
937
insert into t2 values (5, 20020204230000);
938
SELECT col1 FROM t1 UNION SELECT col1 FROM t2 WHERE stamp < '20020204120000' GROUP BY col1;
1 by brian
clean slate
939
drop table t1,t2;
940
941
#
942
# Test by Francois MASUREL
943
#
944
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.
945
if(!$using_temp)
946
{
947
eval create $temp table t1 (
685.4.4 by Jay Pipes
Re-enabled and fixed the mix2_myisam test.
948
  `id` int NOT NULL auto_increment,
949
  `id_object` int default '0',
950
  `id_version` int NOT NULL default '1',
1 by brian
clean slate
951
  `label` varchar(100) NOT NULL default '',
952
  `description` text,
953
  PRIMARY KEY  (`id`),
954
  KEY `id_object` (`id_object`),
955
  KEY `id_version` (`id_version`)
956
) ENGINE=$engine_type;
957
958
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);
959
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.
960
eval create $temp table t2 (
685.4.4 by Jay Pipes
Re-enabled and fixed the mix2_myisam test.
961
  `id` int NOT NULL auto_increment,
962
  `id_version` int NOT NULL default '1',
1 by brian
clean slate
963
  PRIMARY KEY  (`id`),
964
  KEY `id_version` (`id_version`)
965
) ENGINE=$engine_type;
966
967
INSERT INTO t2 VALUES("3524", "1"),("3525", "1"),("1794", "4"),("102", "5"),("1822", "6"),("3382", "9");
968
969
SELECT t2.id, t1.`label` FROM t2 INNER JOIN
970
(SELECT t1.id_object as id_object FROM t1 WHERE t1.`label` LIKE '%test%') AS lbl
971
ON (t2.id = lbl.id_object) INNER JOIN t1 ON (t2.id = t1.id_object);
972
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.
973
}
1 by brian
clean slate
974
975
# Live checksum feature available + enabled
1117.1.2 by Brian Aker
Remove CHECKSUM option in create table.
976
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
977
# Live checksum feature available + disabled
1117.1.2 by Brian Aker
Remove CHECKSUM option in create table.
978
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
979
#
980
# Live checksum feature not available + enabled
1117.1.2 by Brian Aker
Remove CHECKSUM option in create table.
981
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
982
# Live checksum feature not available + disabled
1117.1.2 by Brian Aker
Remove CHECKSUM option in create table.
983
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
984
#
985
# Live checksum feature probably available + enabled
1117.1.2 by Brian Aker
Remove CHECKSUM option in create table.
986
eval create $temp table t5 (a int, b varchar(200), c text not null) engine=$engine_type;
1 by brian
clean slate
987
# Live checksum feature probably available + disabled
1117.1.2 by Brian Aker
Remove CHECKSUM option in create table.
988
eval create $temp table t6 (a int, b varchar(200), c text not null) engine=$engine_type;
1 by brian
clean slate
989
#
990
insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
991
insert t2 select * from t1;
992
insert t3 select * from t1;
993
insert t4 select * from t1;
994
insert t5 select * from t1;
995
insert t6 select * from t1;
996
# #show table status;
997
drop table t1,t2,t3, t4, t5, t6;
998
999
#
1000
# Test problem with refering to different fields in same table in UNION
1001
# (Bug#2552: UNION returns NULL instead of expected value (innoDB only tables))
1002
#
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.
1003
if(!$using_temp)
1004
{
1005
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
1006
insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt');
1007
select trim(name2) from t1  union all  select trim(name) from t1 union all select trim(id) from t1;
1008
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.
1009
}
1010
#
1011
# Bug#2160: Extra error message for create $temp table LIKE with InnoDB
1012
#
1013
eval create $temp table t1 (a int) engine=$engine_type;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1014
--error ER_CANT_CREATE_TABLE
1 by brian
clean slate
1015
create table t2 like t1;
1222.1.1 by Brian Aker
Second pass through bugs related to CREATE TABLE LIKE
1016
create table t2 like t1 engine=innodb;
1 by brian
clean slate
1017
show create table t2;
1018
drop table t1,t2;
1019
1020
if ($test_foreign_keys)
1021
{
1022
#
1023
# Test of automaticly created foreign keys
1024
#
1025
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.
1026
eval create $temp table t1 (id int not null, id2 int not null, unique (id,id2)) engine=$engine_type;
1027
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
1028
show create table t1;
1029
show create table t2;
1030
create index id on t2 (id);
1031
show create table t2;
1032
create index id2 on t2 (id);
1033
show create table t2;
1034
drop index id2 on t2;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1035
--error ER_ERROR_ON_RENAME, ER_ERROR_ON_RENAME
1 by brian
clean slate
1036
drop index id on t2;
1037
show create table t2;
1038
drop table t2;
1039
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.
1040
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
1041
show create table t2;
1042
create unique index id on t2 (id,id2);
1043
show create table t2;
1044
drop table t2;
1045
1046
# 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.
1047
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;
1048
show create table t2;
1049
drop table t2;
1050
1051
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;
1052
show create table t2;
1053
drop table t2;
1054
1055
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;
1056
show create table t2;
1057
drop table t2;
1058
1059
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;
1060
show create table t2;
1061
drop table t2;
1062
1063
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
1064
show create table t2;
1065
alter table t2 add index id_test (id), add index id_test2 (id,id2);
1066
show create table t2;
1067
drop table t2;
1068
1069
# Test error handling
1070
1071
# Clean up filename -- embedded server reports whole path without .frm,
1072
# regular server reports relative path with .frm (argh!)
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
1073
--replace_result \\ / $DRIZZLE_TEST_DIR . /var/master-data/ / t2.frm t2
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1074
--error ER_CANT_CREATE_TABLE
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.
1075
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
1076
1077
# bug#3749
1078
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.
1079
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
1080
show create table t2;
1081
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.
1082
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
1083
show create table t2;
1084
drop table t2, t1;
1085
}
1086
# End of FOREIGN KEY tests
1087
1088
1089
#
1090
# Let us test binlog_cache_use and binlog_cache_disk_use status vars.
1091
# Actually this test has nothing to do with innodb per se, it just requires
1092
# transactional table.
1093
#
1094
flush status;
1095
show status like "binlog_cache_use";
1096
show status like "binlog_cache_disk_use";
1097
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.
1098
eval create $temp table t1 (a int) engine=$engine_type;
1 by brian
clean slate
1099
1100
# Now we are going to create transaction which is long enough so its
1101
# transaction binlog will be flushed to disk...
1102
let $1=2000;
1103
disable_query_log;
1104
begin;
1105
while ($1)
1106
{
1107
 eval insert into t1 values( $1 );
1108
 dec $1;
1109
}
1110
commit;
1111
enable_query_log;
1112
show status like "binlog_cache_use";
1113
show status like "binlog_cache_disk_use";
1114
1115
# Transaction which should not be flushed to disk and so should not
1116
# increase binlog_cache_disk_use.
1117
begin;
1118
delete from t1;
1119
commit;
1120
show status like "binlog_cache_use";
1121
show status like "binlog_cache_disk_use";
1122
drop table t1;
1123
1124
#
1125
# Bug #6126: Duplicate columns in keys gives misleading error message
1126
#
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1127
--error ER_DUP_FIELDNAME
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.
1128
eval create $temp table t1 (c char(10), index (c,c)) engine=$engine_type;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1129
--error ER_DUP_FIELDNAME
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.
1130
eval create $temp table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=$engine_type;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1131
--error ER_DUP_FIELDNAME
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.
1132
eval create $temp table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=$engine_type;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1133
--error ER_DUP_FIELDNAME
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.
1134
eval create $temp table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=$engine_type;
1135
eval create $temp table t1 (c1 char(10), c2 char(10)) engine=$engine_type;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1136
--error ER_DUP_FIELDNAME
1 by brian
clean slate
1137
alter table t1 add key (c1,c1);
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1138
--error ER_DUP_FIELDNAME
1 by brian
clean slate
1139
alter table t1 add key (c2,c1,c1);
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1140
--error ER_DUP_FIELDNAME
1 by brian
clean slate
1141
alter table t1 add key (c1,c2,c1);
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1142
--error ER_DUP_FIELDNAME
1 by brian
clean slate
1143
alter table t1 add key (c1,c1,c2);
1144
drop table t1;
1145
1146
#
1147
# Bug #4082: integer truncation
1148
#
1149
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.
1150
eval create $temp table t1(a int, b int) engine=$engine_type;
1 by brian
clean slate
1151
insert into t1 values ('1111', '3333');
1152
select distinct concat(a, b) from t1;
1153
drop table t1;
1154
1155
if ($fulltext_query_unsupported)
1156
{
1157
#
1158
# BUG#7709 test case - Boolean fulltext query against unsupported
1159
#                      engines does not fail
1160
#
1161
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.
1162
eval create $temp table t1 ( a char(10) ) ENGINE=$engine_type;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1163
--error ER_TABLE_CANT_HANDLE_FT
1 by brian
clean slate
1164
SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
1165
DROP TABLE t1;
1166
}
1167
1168
if ($test_foreign_keys)
1169
{
1170
#
1171
# check null values #1
1172
#
1173
1174
--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.
1175
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
1176
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.
1177
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
1178
                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;
1179
--enable_warnings
1180
INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2);
1181
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;
1182
DROP TABLE t2;
1183
DROP TABLE t1;
1184
}
1185
1186
#
1187
# Bug#11816 - Truncate table doesn't work with temporary innodb tables
1188
# This is not an innodb bug, but we test it using innodb.
1189
#
1190
eval create temporary table t1 (a int) engine=$engine_type;
1191
insert into t1 values (4711);
1192
truncate t1;
1193
insert into t1 values (42);
1194
select * from t1;
1195
drop table t1;
1196
# 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.
1197
eval create $temp table t1 (a int) engine=$engine_type;
1 by brian
clean slate
1198
insert into t1 values (4711);
1199
truncate t1;
1200
insert into t1 values (42);
1201
select * from t1;
1202
drop table t1;
1203
1204
#
1205
# Bug #13025  Server crash during filesort	
1206
#
1207
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.
1208
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
1209
insert into t1 values (2,2,"b",2,2),(1,1,"a",1,1),(3,3,"ab",3,3);
1210
select * from t1 order by a,b,c,d;
1211
explain select * from t1 order by a,b,c,d;
1212
drop table t1;
1213
1214
#
1215
# BUG#11039,#13218 Wrong key length in min()
1216
#
1217
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.
1218
eval create $temp table t1 (a char(1), b char(1), key(a, b)) engine=$engine_type;
1 by brian
clean slate
1219
insert into t1 values ('8', '6'), ('4', '7');
1220
select min(a) from t1;
1221
select min(b) from t1 where a='8';
1222
drop table t1;
1223
1224
# End of 4.1 tests
1225
1226
#
1227
# range optimizer problem
1228
#
1229
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.
1230
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.
1231
# The below is out of range for a BIGINT (signed)
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1232
--error ER_WARN_DATA_OUT_OF_RANGE
1 by brian
clean slate
1233
insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1);
1234
select * from t1;
1235
select count(*) from t1 where x>0;
1236
select count(*) from t1 where x=0;
1237
select count(*) from t1 where x<0;
1238
select count(*) from t1 where x < -16;
1239
select count(*) from t1 where x = -16;
1240
explain select count(*) from t1 where x > -16;
1241
select count(*) from t1 where x > -16;
1242
select * from t1 where x > -16;
1243
select count(*) from t1 where x = 18446744073709551601;
1244
drop table t1;
1245
1246
# Please do not remove the following skipped InnoDB specific tests.
1247
# They make the synchronization with innodb.test easier and give
1248
# an idea what to test on other storage engines.
1249
if (0)
1250
{
1251
1252
# Test for testable InnoDB status variables. This test
1253
# uses previous ones(pages_created, rows_deleted, ...).
1254
show status like "Innodb_buffer_pool_pages_total";
1255
show status like "Innodb_page_size";
1256
show status like "Innodb_rows_deleted";
1257
show status like "Innodb_rows_inserted";
1258
show status like "Innodb_rows_updated";
1259
1260
# Test for row locks InnoDB status variables.
1261
show status like "Innodb_row_lock_waits";
1262
show status like "Innodb_row_lock_current_waits";
1263
show status like "Innodb_row_lock_time";
1264
show status like "Innodb_row_lock_time_max";
1265
show status like "Innodb_row_lock_time_avg";
1266
1267
# Test for innodb_sync_spin_loops variable
1268
show variables like "innodb_sync_spin_loops";
1269
set global innodb_sync_spin_loops=1000;
1270
show variables like "innodb_sync_spin_loops";
1271
set global innodb_sync_spin_loops=0;
1272
show variables like "innodb_sync_spin_loops";
1273
set global innodb_sync_spin_loops=20;
1274
show variables like "innodb_sync_spin_loops";
1275
1276
# Test for innodb_thread_concurrency variable
1277
show variables like "innodb_thread_concurrency";
1278
set global innodb_thread_concurrency=1001;
1279
show variables like "innodb_thread_concurrency";
1280
set global innodb_thread_concurrency=0;
1281
show variables like "innodb_thread_concurrency";
1282
set global innodb_thread_concurrency=16;
1283
show variables like "innodb_thread_concurrency";
1284
1285
# Test for innodb_concurrency_tickets variable
1286
show variables like "innodb_concurrency_tickets";
1287
set global innodb_concurrency_tickets=1000;
1288
show variables like "innodb_concurrency_tickets";
1289
set global innodb_concurrency_tickets=0;
1290
show variables like "innodb_concurrency_tickets";
1291
set global innodb_concurrency_tickets=500;
1292
show variables like "innodb_concurrency_tickets";
1293
1294
# Test for innodb_thread_sleep_delay variable
1295
show variables like "innodb_thread_sleep_delay";
1296
set global innodb_thread_sleep_delay=100000;
1297
show variables like "innodb_thread_sleep_delay";
1298
set global innodb_thread_sleep_delay=0;
1299
show variables like "innodb_thread_sleep_delay";
1300
set global innodb_thread_sleep_delay=10000;
1301
show variables like "innodb_thread_sleep_delay";
1302
1303
}
1304
1305
1306
#
1307
# Test varchar
1308
#
1309
1310
let $default=`select @@storage_engine`;
1311
eval set storage_engine=$engine_type;
1312
source include/varchar.inc;
1313
1314
#
1315
# Some errors/warnings on create
1316
#
1317
1318
# Clean up filename -- embedded server reports whole path without .frm,
1319
# regular server reports relative path with .frm (argh!)
685.4.4 by Jay Pipes
Re-enabled and fixed the mix2_myisam test.
1320
# @TODO The below fails because it assumes latin1
1321
# as the charset.  Possibly re-enable a similar test
1322
#--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.
1323
#create $temp table t1 (v varchar(65530), key(v));
685.4.4 by Jay Pipes
Re-enabled and fixed the mix2_myisam test.
1324
#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.
1325
#create $temp table t1 (v varchar(65536));
685.4.4 by Jay Pipes
Re-enabled and fixed the mix2_myisam test.
1326
#show create table t1;
1327
#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.
1328
#create $temp table t1 (v varchar(65530) character set utf8);
685.4.4 by Jay Pipes
Re-enabled and fixed the mix2_myisam test.
1329
#show create table t1;
1330
#drop table t1;
1331
#
1332
#eval set storage_engine=$default;
1333
#
1 by brian
clean slate
1334
# 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.
1335
#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.
1336
#drop table t1;
1 by brian
clean slate
1337
1338
#
1339
# BUG#11039 Wrong key length in min()
1340
#
1341
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.
1342
eval create $temp table t1 (a char(1), b char(1), key(a, b)) engine=$engine_type;
1 by brian
clean slate
1343
insert into t1 values ('8', '6'), ('4', '7');
1344
select min(a) from t1;
1345
select min(b) from t1 where a='8';
1346
drop table t1;
1347
1348
#
1349
# Bug #11080 & #11005  Multi-row REPLACE fails on a duplicate key error
1350
#
1351
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.
1352
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
1353
insert into t1 (b) values (1);
1354
replace into t1 (b) values (2), (1), (3);
1355
select * from t1;
1356
truncate table t1;
1357
insert into t1 (b) values (1);
1358
replace into t1 (b) values (2);
1359
replace into t1 (b) values (1);
1360
replace into t1 (b) values (3);
1361
select * from t1;
1362
drop table t1;
1363
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.
1364
eval create $temp table t1 (rowid int not null auto_increment, val int not null,primary
1 by brian
clean slate
1365
key (rowid), unique(val)) engine=$engine_type;
1366
replace into t1 (val) values ('1'),('2');
1367
replace into t1 (val) values ('1'),('2');
1368
--error ER_DUP_ENTRY
1369
insert into t1 (val) values ('1'),('2');
1370
select * from t1;
1371
drop table t1;
1372
1373
if ($no_autoinc_update)
1374
{
1375
#
1376
# Test that update does not change internal auto-increment value
1377
#
1378
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.
1379
eval create $temp table t1 (a int not null auto_increment primary key, val int) engine=$engine_type;
1 by brian
clean slate
1380
insert into t1 (val) values (1);
1381
update t1 set a=2 where a=1;
1382
# We should get the following error because InnoDB does not update the counter
1383
--error ER_DUP_ENTRY
1384
insert into t1 (val) values (1);
1385
select * from t1;
1386
drop table t1;
1387
}
1388
1389
1390
#
1391
# Bug#10465: DECIMAL, crash on DELETE (InnoDB only)
1392
#
1393
1394
--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.
1395
eval create $temp table t1 (GRADE DECIMAL(4) NOT NULL, PRIMARY KEY (GRADE)) ENGINE=$engine_type;
1 by brian
clean slate
1396
--enable_warnings
1397
INSERT INTO t1 (GRADE) VALUES (151),(252),(343);
1398
SELECT GRADE  FROM t1 WHERE GRADE > 160 AND GRADE < 300;
1399
SELECT GRADE  FROM t1 WHERE GRADE= 151;
1400
DROP TABLE t1;
1401
1402
if ($test_foreign_keys)
1403
{
1404
#
1405
# Test that the slow TRUNCATE implementation resets autoincrement columns
1406
# (bug #11946)
1407
#
1408
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.
1409
eval create $temp table t1 (
1 by brian
clean slate
1410
id INTEGER NOT NULL AUTO_INCREMENT, PRIMARY KEY (id)
1411
) ENGINE=$engine_type;
1412
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.
1413
eval create $temp table t2 (
1 by brian
clean slate
1414
id INTEGER NOT NULL,
1415
FOREIGN KEY (id) REFERENCES t1 (id)
1416
) ENGINE=$engine_type;
1417
1418
INSERT INTO t1 (id) VALUES (NULL);
1419
SELECT * FROM t1;
1420
TRUNCATE t1;
1421
INSERT INTO t1 (id) VALUES (NULL);
1422
SELECT * FROM t1;
1423
1424
# continued from above; test that doing a slow TRUNCATE on a table with 0
1425
# rows resets autoincrement columns
1426
DELETE FROM t1;
1427
TRUNCATE t1;
1428
INSERT INTO t1 (id) VALUES (NULL);
1429
SELECT * FROM t1;
1430
DROP TABLE t2, t1;
1431
1432
# 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.
1433
eval create $temp table t1
1 by brian
clean slate
1434
(
1435
 id INT PRIMARY KEY
1436
) ENGINE=$engine_type;
1437
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1438
--error ER_CANT_CREATE_TABLE, ER_CANT_CREATE_TABLE
1 by brian
clean slate
1439
eval CREATE TEMPORARY TABLE t2
1440
(
1441
 id INT NOT NULL PRIMARY KEY,
1442
 b INT,
1443
 FOREIGN KEY (b) REFERENCES test.t1(id)
1444
) ENGINE=$engine_type;
1445
DROP TABLE t1;
1446
}
1447
# End of FOREIGN KEY test
1448
1449
# Please do not remove the following skipped InnoDB specific tests.
1450
# They make the synchronization with innodb.test easier and give
1451
# an idea what to test on other storage engines.
1452
if (0)
1453
{
1454
1455
#
1456
# Test that index column max sizes are honored (bug #13315)
1457
#
1458
1459
# 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.
1460
eval create $temp table t1 (col1 varchar(2000), index (col1(767)))
1 by brian
clean slate
1461
 character set = latin1 engine = $engine_type;
1462
1463
# 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.
1464
eval create $temp table t2 (col1 char(255), index (col1))
1465
 character set = latin1 engine = $engine_type;
1466
eval create $temp table t3 (col1 binary(255), index (col1))
1467
 character set = latin1 engine = $engine_type;
1468
eval create $temp table t4 (col1 varchar(767), index (col1))
1469
 character set = latin1 engine = $engine_type;
1470
eval create $temp table t5 (col1 varchar(767) primary key)
1471
 character set = latin1 engine = $engine_type;
1472
eval create $temp table t6 (col1 varbinary(767) primary key)
1473
 character set = latin1 engine = $engine_type;
1474
eval create $temp table t7 (col1 text, index(col1(767)))
1475
 character set = latin1 engine = $engine_type;
1476
eval create $temp table t8 (col1 blob, index(col1(767)))
1 by brian
clean slate
1477
 character set = latin1 engine = $engine_type;
1478
1479
1480
# 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.
1481
eval create $temp table t9 (col1 varchar(512), col2 varchar(512), index(col1, col2))
1 by brian
clean slate
1482
 character set = latin1 engine = $engine_type;
1483
1484
show create table t9;
1485
1486
drop table t1, t2, t3, t4, t5, t6, t7, t8, t9;
1487
1488
# 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.
1489
eval create $temp table t1 (col1 varchar(768), index(col1))
1490
 character set = latin1 engine = $engine_type;
1491
eval create $temp table t2 (col1 varbinary(768), index(col1))
1492
 character set = latin1 engine = $engine_type;
1493
eval create $temp table t3 (col1 text, index(col1(768)))
1494
 character set = latin1 engine = $engine_type;
1495
eval create $temp table t4 (col1 blob, index(col1(768)))
1 by brian
clean slate
1496
 character set = latin1 engine = $engine_type;
1497
1498
show create table t1;
1499
1500
drop table t1, t2, t3, t4;
1501
1502
}
1503
# End of skipped test
1504
1505
# Please do not remove the following skipped InnoDB specific tests.
1506
# They make the synchronization with innodb.test easier and give
1507
# an idea what to test on other storage engines.
1508
if (0)
1509
{
1510
1511
# these should be refused
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1512
--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.
1513
eval create $temp table t1 (col1 varchar(768) primary key)
1514
 character set = latin1 engine = $engine_type;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1515
--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.
1516
eval create $temp table t2 (col1 varbinary(768) primary key)
1517
 character set = latin1 engine = $engine_type;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1518
--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.
1519
eval create $temp table t3 (col1 text, primary key(col1(768)))
1520
 character set = latin1 engine = $engine_type;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1521
--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.
1522
eval create $temp table t4 (col1 blob, primary key(col1(768)))
1 by brian
clean slate
1523
 character set = latin1 engine = $engine_type;
1524
1525
}
1526
1527
if ($test_foreign_keys)
1528
{
1529
#
1530
# Test improved foreign key error messages (bug #3443)
1531
#
1532
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.
1533
eval create $temp table t1
1 by brian
clean slate
1534
(
1535
 id INT PRIMARY KEY
1536
) ENGINE=$engine_type;
1537
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.
1538
eval create $temp table t2
1 by brian
clean slate
1539
(
1540
 v INT,
1541
 CONSTRAINT c1 FOREIGN KEY (v) REFERENCES t1(id)
1542
) ENGINE=$engine_type;
1543
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1544
--error ER_NO_REFERENCED_ROW_2
1 by brian
clean slate
1545
INSERT INTO t2 VALUES(2);
1546
1547
INSERT INTO t1 VALUES(1);
1548
INSERT INTO t2 VALUES(1);
1549
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1550
--error ER_ROW_IS_REFERENCED_2
1 by brian
clean slate
1551
DELETE FROM t1 WHERE id = 1;
1552
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1553
--error ER_ROW_IS_REFERENCED
1 by brian
clean slate
1554
DROP TABLE t1;
1555
1556
SET FOREIGN_KEY_CHECKS=0;
1557
DROP TABLE t1;
1558
SET FOREIGN_KEY_CHECKS=1;
1559
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1560
--error ER_NO_REFERENCED_ROW_2
1 by brian
clean slate
1561
INSERT INTO t2 VALUES(3);
1562
1563
DROP TABLE t2;
1564
}
1565
# End of FOREIGN tests
1566
1567
# tests for bugs #9802 and #13778
1568
1569
if ($test_foreign_keys)
1570
{
1571
# test that FKs between invalid types are not accepted
1572
1573
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.
1574
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
1575
--replace_result $MYSQLTEST_VARDIR . master-data/ ''
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1576
--error ER_CANT_CREATE_TABLE
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.
1577
eval create $temp table t1(a char(10) primary key, b varchar(20)) engine = $engine_type;
1 by brian
clean slate
1578
set foreign_key_checks=1;
1579
drop table t2;
1580
1581
# test that FKs between different charsets are not accepted in CREATE even
1582
# when f_k_c is 0
1583
1584
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.
1585
eval create $temp table t1(a varchar(10) primary key) engine = $engine_type DEFAULT CHARSET=latin1;
1 by brian
clean slate
1586
--replace_result $MYSQLTEST_VARDIR . master-data/ ''
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1587
--error ER_CANT_CREATE_TABLE
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.
1588
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
1589
set foreign_key_checks=1;
1590
drop table t1;
1591
1592
# test that invalid datatype conversions with ALTER are not allowed
1593
1594
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.
1595
eval create $temp table t2 (a varchar(10), foreign key (a) references t1(a)) engine = $engine_type;
1596
eval create $temp table t1(a varchar(10) primary key) engine = $engine_type;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1597
--error ER_ERROR_ON_RENAME, ER_ERROR_ON_RENAME
1 by brian
clean slate
1598
alter table t1 modify column a int;
1599
set foreign_key_checks=1;
1600
drop table t2,t1;
1601
1602
# test that charset conversions with ALTER are allowed when f_k_c is 0
1603
1604
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.
1605
eval create $temp table t2 (a varchar(10), foreign key (a) references t1(a)) engine = $engine_type DEFAULT CHARSET=latin1;
1606
eval create $temp table t1(a varchar(10) primary key) engine = $engine_type DEFAULT CHARSET=latin1;
1 by brian
clean slate
1607
alter table t1 convert to character set utf8;
1608
set foreign_key_checks=1;
1609
drop table t2,t1;
1610
1611
# test that RENAME does not allow invalid charsets when f_k_c is 0
1612
1613
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.
1614
eval create $temp table t2 (a varchar(10), foreign key (a) references t1(a)) engine = $engine_type DEFAULT CHARSET=latin1;
1615
eval create $temp table t3(a varchar(10) primary key) engine = $engine_type DEFAULT CHARSET=utf8;
1 by brian
clean slate
1616
--replace_result $MYSQLTEST_VARDIR . master-data/ ''
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1617
--error ER_ERROR_ON_RENAME
1 by brian
clean slate
1618
rename table t3 to t1;
1619
set foreign_key_checks=1;
1620
drop table t2,t3;
1621
1622
# test that foreign key errors are reported correctly (Bug #15550)
1623
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.
1624
eval create $temp table t1(a int primary key) row_format=redundant engine=$engine_type;
1625
eval create $temp table t2(a int primary key,constraint foreign key(a)references t1(a)) row_format=compact engine=$engine_type;
1626
eval create $temp table t3(a int primary key) row_format=compact engine=$engine_type;
1627
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
1628
1629
insert into t1 values(1);
1630
insert into t3 values(1);
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1631
--error ER_NO_REFERENCED_ROW_2
1 by brian
clean slate
1632
insert into t2 values(2);
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1633
--error ER_NO_REFERENCED_ROW_2
1 by brian
clean slate
1634
insert into t4 values(2);
1635
insert into t2 values(1);
1636
insert into t4 values(1);
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1637
--error ER_ROW_IS_REFERENCED_2
1 by brian
clean slate
1638
update t1 set a=2;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1639
--error ER_NO_REFERENCED_ROW_2
1 by brian
clean slate
1640
update t2 set a=2;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1641
--error ER_ROW_IS_REFERENCED_2
1 by brian
clean slate
1642
update t3 set a=2;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1643
--error ER_NO_REFERENCED_ROW_2
1 by brian
clean slate
1644
update t4 set a=2;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1645
--error ER_ROW_IS_REFERENCED_2
1 by brian
clean slate
1646
truncate t1;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1647
--error ER_ROW_IS_REFERENCED_2
1 by brian
clean slate
1648
truncate t3;
1649
truncate t2;
1650
truncate t4;
1651
truncate t1;
1652
truncate t3;
1653
1654
drop table t4,t3,t2,t1;
1655
}
1656
# End of FOREIGN KEY tests
1657
1658
1659
# Please do not remove the following skipped InnoDB specific tests.
1660
# They make the synchronization with innodb.test easier and give
1661
# an idea what to test on other storage engines.
1662
if (0)
1663
{
1664
1665
#
1666
# Test that we can create a large (>1K) key
1667
#
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.
1668
eval create $temp table t1 (a varchar(255) character set utf8,
1 by brian
clean slate
1669
                 b varchar(255) character set utf8,
1670
                 c varchar(255) character set utf8,
1671
                 d varchar(255) character set utf8,
1672
                 key (a,b,c,d)) engine=$engine_type;
1673
drop table t1;
1674
--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.
1675
eval create $temp table t1 (a varchar(255) character set utf8,
1 by brian
clean slate
1676
                 b varchar(255) character set utf8,
1677
                 c varchar(255) character set utf8,
1678
                 d varchar(255) character set utf8,
1679
                 e varchar(255) character set utf8,
1680
                 key (a,b,c,d,e)) engine=$engine_type;
1681
1682
1683
# test the padding of BINARY types and collations (Bug #14189)
1684
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.
1685
eval create $temp table t1 (s1 varbinary(2),primary key (s1)) engine=$engine_type;
1686
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.
1687
eval create $temp table t3 (s1 varchar(2),primary key (s1)) engine=$engine_type;
1688
eval create $temp table t4 (s1 char(2),primary key (s1)) engine=$engine_type;
1 by brian
clean slate
1689
1690
insert into t1 values (0x41),(0x4120),(0x4100);
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1691
--error ER_DUP_ENTRY
1 by brian
clean slate
1692
insert into t2 values (0x41),(0x4120),(0x4100);
1693
insert into t2 values (0x41),(0x4120);
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1694
--error ER_DUP_ENTRY
1 by brian
clean slate
1695
insert into t3 values (0x41),(0x4120),(0x4100);
1696
insert into t3 values (0x41),(0x4100);
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1697
--error ER_DUP_ENTRY
1 by brian
clean slate
1698
insert into t4 values (0x41),(0x4120),(0x4100);
1699
insert into t4 values (0x41),(0x4100);
1700
select hex(s1) from t1;
1701
select hex(s1) from t2;
1702
select hex(s1) from t3;
1703
select hex(s1) from t4;
1704
drop table t1,t2,t3,t4;
1705
}
1706
1707
if (test_foreign_keys)
1708
{
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.
1709
eval create $temp table t1 (a int primary key,s1 varbinary(3) not null unique) engine=$engine_type;
1710
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
1711
1712
insert into t1 values(1,0x4100),(2,0x41),(3,0x4120),(4,0x42);
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1713
--error ER_NO_REFERENCED_ROW_2
1 by brian
clean slate
1714
insert into t2 values(0x42);
1715
insert into t2 values(0x41);
1716
select hex(s1) from t2;
1717
update t1 set s1=0x123456 where a=2;
1718
select hex(s1) from t2;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1719
--error ER_ROW_IS_REFERENCED_2
1 by brian
clean slate
1720
update t1 set s1=0x12 where a=1;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1721
--error ER_ROW_IS_REFERENCED_2
1 by brian
clean slate
1722
update t1 set s1=0x12345678 where a=1;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1723
--error ER_ROW_IS_REFERENCED_2
1 by brian
clean slate
1724
update t1 set s1=0x123457 where a=1;
1725
update t1 set s1=0x1220 where a=1;
1726
select hex(s1) from t2;
1727
update t1 set s1=0x1200 where a=1;
1728
select hex(s1) from t2;
1729
update t1 set s1=0x4200 where a=1;
1730
select hex(s1) from t2;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1731
--error ER_ROW_IS_REFERENCED_2
1 by brian
clean slate
1732
delete from t1 where a=1;
1733
delete from t1 where a=2;
1734
update t2 set s1=0x4120;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1735
--error ER_ROW_IS_REFERENCED_2
1 by brian
clean slate
1736
delete from t1;
1737
delete from t1 where a!=3;
1738
select a,hex(s1) from t1;
1739
select hex(s1) from t2;
1740
1741
drop table t2,t1;
1742
1217 by Brian Aker
Removed bits of charset support from the parser.
1743
eval create $temp table t1 (a int primary key,s1 varchar(2) not null unique) engine=$engine_type;
1744
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
1745
1746
insert into t1 values(1,0x4100),(2,0x41);
1747
insert into t2 values(0x41);
1748
select hex(s1) from t2;
1749
update t1 set s1=0x1234 where a=1;
1750
select hex(s1) from t2;
1751
update t1 set s1=0x12 where a=2;
1752
select hex(s1) from t2;
1753
delete from t1 where a=1;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1754
--error ER_ROW_IS_REFERENCED_2
1 by brian
clean slate
1755
delete from t1 where a=2;
1756
select a,hex(s1) from t1;
1757
select hex(s1) from t2;
1758
1759
drop table t2,t1;
1760
}
1761
# End FOREIGN KEY tests
1762
1763
if ($test_foreign_keys)
1764
{
1765
# Ensure that <tablename>_ibfk_0 is not mistreated as a
1766
# generated foreign key identifier.  (Bug #16387)
1767
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.
1768
eval create $temp table t1(a INT, PRIMARY KEY(a)) ENGINE=$engine_type;
1769
eval create $temp table t2(a INT) ENGINE=$engine_type;
1 by brian
clean slate
1770
ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1(a);
1771
ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_1;
1772
ALTER TABLE t2 ADD CONSTRAINT t2_ibfk_0 FOREIGN KEY (a) REFERENCES t1(a);
1773
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.
1774
SHOW create $temp table t2;
1 by brian
clean slate
1775
DROP TABLE t2,t1;
1776
}
1777
1778
if ($test_foreign_keys)
1779
{
1780
#
1781
# Test that cascading updates leading to duplicate keys give the correct
1782
# error message (bug #9680)
1783
#
1784
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.
1785
eval create $temp table t1 (
1 by brian
clean slate
1786
  field1 varchar(8) NOT NULL DEFAULT '',
1787
  field2 varchar(8) NOT NULL DEFAULT '',
1788
  PRIMARY KEY  (field1, field2)
1789
) ENGINE=$engine_type;
1790
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.
1791
eval create $temp table t2 (
1 by brian
clean slate
1792
  field1 varchar(8) NOT NULL DEFAULT '' PRIMARY KEY,
1793
  FOREIGN KEY (field1) REFERENCES t1 (field1)
1794
    ON DELETE CASCADE ON UPDATE CASCADE
1795
) ENGINE=$engine_type;
1796
1797
INSERT INTO t1 VALUES ('old', 'somevalu');
1798
INSERT INTO t1 VALUES ('other', 'anyvalue');
1799
1800
INSERT INTO t2 VALUES ('old');
1801
INSERT INTO t2 VALUES ('other');
1802
1803
--error ER_FOREIGN_DUPLICATE_KEY
1804
UPDATE t1 SET field1 = 'other' WHERE field2 = 'somevalu';
1805
1806
DROP TABLE t2;
1807
DROP TABLE t1;
1808
1809
#
1810
# Bug#18477 - MySQL/InnoDB Ignoring Foreign Keys in ALTER TABLE
1811
#
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.
1812
eval create $temp table t1 (
1 by brian
clean slate
1813
  c1 bigint not null,
1814
  c2 bigint not null,
1815
  primary key (c1),
1816
  unique  key (c2)
1817
) engine=$engine_type;
1818
#
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.
1819
eval create $temp table t2 (
1 by brian
clean slate
1820
  c1 bigint not null,
1821
  primary key (c1)
1822
) engine=$engine_type;
1823
#
1824
alter table t1 add constraint c2_fk foreign key (c2)
1825
  references t2(c1) on delete cascade;
1826
show create table t1;
1827
#
1828
alter table t1 drop foreign key c2_fk;
1829
show create table t1;
1830
#
1831
drop table t1, t2;
1832
}
1833
# End FOREIGN KEY test
1834
1835
#
1836
# Bug #14360: problem with intervals
1837
#
1838
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.
1839
eval create $temp table t1(a date) engine=$engine_type;
1840
eval create $temp table t2(a date, key(a)) engine=$engine_type;
1 by brian
clean slate
1841
insert into t1 values('2005-10-01');
1842
insert into t2 values('2005-10-01');
1843
select * from t1, t2
1844
  where t2.a between t1.a - interval 2 day and t1.a + interval 2 day;
1845
drop table t1, t2;
1846
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.
1847
eval create $temp table t1 (id int not null, f_id int not null, f int not null,
1 by brian
clean slate
1848
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.
1849
eval create $temp table t2 (id int not null,s_id int not null,s varchar(200),
1 by brian
clean slate
1850
primary key(id)) engine=$engine_type;
1851
INSERT INTO t1 VALUES (8, 1, 3);
1852
INSERT INTO t1 VALUES (1, 2, 1);
1853
INSERT INTO t2 VALUES (1, 0, '');
1854
INSERT INTO t2 VALUES (8, 1, '');
1855
commit;
1856
select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id)
1857
where mm.id is null lock in share mode;
1858
drop table t1,t2;
1859
1860
#
1861
# Test case where X-locks on unused rows should be released in a
1862
# update (because READ COMMITTED isolation level)
1863
#
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.
1864
if(!$using_temp)
1865
{
1 by brian
clean slate
1866
connect (a,localhost,root,,);
1867
connect (b,localhost,root,,);
1868
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.
1869
eval create $temp table t1(a int not null, b int, primary key(a)) engine=$engine_type;
1 by brian
clean slate
1870
insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
1871
commit;
1872
set autocommit = 0;
1873
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
1874
update t1 set b = 5 where b = 1;
1875
connection b;
1876
set autocommit = 0;
1877
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
1878
#
1879
# X-lock to record (7,3) should be released in a update
1880
#
1881
select * from t1 where a = 7 and b = 3 for update;
1882
connection a;
1883
commit;
1884
connection b;
1885
commit;
1886
drop table t1;
1887
connection default;
1888
disconnect a;
1889
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.
1890
}
1 by brian
clean slate
1891
if ($test_transactions)
1892
{
1893
#
1894
# Test case where no locks should be released (because we are not
1895
# using READ COMMITTED isolation level)
1896
#
1897
1898
connect (a,localhost,root,,);
1899
connect (b,localhost,root,,);
1900
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.
1901
eval create $temp table t1(a int not null, b int, primary key(a)) engine=$engine_type;
1 by brian
clean slate
1902
insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2);
1903
commit;
1904
set autocommit = 0;
1905
select * from t1 lock in share mode;
1906
update t1 set b = 5 where b = 1;
1907
connection b;
1908
set autocommit = 0;
1909
#
1910
# S-lock to records (2,2),(4,2), and (6,2) should not be released in a update
1911
#
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1912
--error ER_XXXLOCK_WAIT_TIMEOUTTTT
1 by brian
clean slate
1913
select * from t1 where a = 2 and b = 2 for update;
1914
#
1915
# X-lock to record (1,1),(3,1),(5,1) should not be released in a update
1916
#
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
1917
--error ER_LOCK_WAIT_TIMEOUT
1 by brian
clean slate
1918
connection a;
1919
commit;
1920
connection b;
1921
commit;
1922
connection default;
1923
disconnect a;
1924
disconnect b;
1925
drop table t1;
1926
1927
#
1928
# Consistent read should be used in following selects
1929
#
1930
# 1) INSERT INTO ... SELECT
1931
# 2) UPDATE ... = ( SELECT ...)
1932
# 3) CREATE ... SELECT
1933
1934
connect (a,localhost,root,,);
1935
connect (b,localhost,root,,);
1936
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.
1937
eval create $temp table t1(a int not null, b int, primary key(a)) engine=$engine_type;
1 by brian
clean slate
1938
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.
1939
eval create $temp table t2(d int not null, e int, primary key(d)) engine=$engine_type;
1 by brian
clean slate
1940
insert into t2 values (8,6),(12,1),(3,1);
1941
commit;
1942
set autocommit = 0;
1943
select * from t2 for update;
1944
connection b;
1945
set autocommit = 0;
1946
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
1947
insert into t1 select * from t2;
1948
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.
1949
eval create $temp table t3(d int not null, e int, primary key(d)) engine=$engine_type
1 by brian
clean slate
1950
select * from t2;
1951
commit;
1952
connection a;
1953
commit;
1954
connection default;
1955
disconnect a;
1956
disconnect b;
1957
drop table t1, t2, t3;
1958
1959
#
1960
# Consistent read should not be used if
1961
#
1962
# (a) isolation level is serializable OR
1963
# (b) select ... lock in share mode OR
1964
# (c) select ... for update
1965
#
1966
# in following queries:
1967
#
1968
# 1) INSERT INTO ... SELECT
1969
# 2) UPDATE ... = ( SELECT ...)
1970
# 3) CREATE ... SELECT
1971
1972
connect (a,localhost,root,,);
1973
eval SET SESSION STORAGE_ENGINE = $engine_type;
1974
connect (b,localhost,root,,);
1975
eval SET SESSION STORAGE_ENGINE = $engine_type;
1976
connect (c,localhost,root,,);
1977
eval SET SESSION STORAGE_ENGINE = $engine_type;
1978
connect (d,localhost,root,,);
1979
eval SET SESSION STORAGE_ENGINE = $engine_type;
1980
connect (e,localhost,root,,);
1981
eval SET SESSION STORAGE_ENGINE = $engine_type;
1982
connect (f,localhost,root,,);
1983
eval SET SESSION STORAGE_ENGINE = $engine_type;
1984
connect (g,localhost,root,,);
1985
eval SET SESSION STORAGE_ENGINE = $engine_type;
1986
connect (h,localhost,root,,);
1987
eval SET SESSION STORAGE_ENGINE = $engine_type;
1988
connect (i,localhost,root,,);
1989
eval SET SESSION STORAGE_ENGINE = $engine_type;
1990
connect (j,localhost,root,,);
1991
eval SET SESSION STORAGE_ENGINE = $engine_type;
1992
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.
1993
create $temp table t1(a int not null, b int, primary key(a));
1 by brian
clean slate
1994
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.
1995
create $temp table t2(a int not null, b int, primary key(a));
1 by brian
clean slate
1996
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.
1997
create $temp table t3(d int not null, b int, primary key(d));
1 by brian
clean slate
1998
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.
1999
create $temp table t5(a int not null, b int, primary key(a));
1 by brian
clean slate
2000
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.
2001
create $temp table t6(d int not null, e int, primary key(d));
1 by brian
clean slate
2002
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.
2003
create $temp table t8(a int not null, b int, primary key(a));
1 by brian
clean slate
2004
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.
2005
create $temp table t9(d int not null, e int, primary key(d));
1 by brian
clean slate
2006
insert into t9 values (8,6),(12,1),(3,1);
2007
commit;
2008
set autocommit = 0;
2009
select * from t2 for update;
2010
connection b;
2011
set autocommit = 0;
2012
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
2013
--send
2014
insert into t1 select * from t2;
2015
connection c;
2016
set autocommit = 0;
2017
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
2018
--send
2019
update t3 set b = (select b from t2 where a = d);
2020
connection d;
2021
set autocommit = 0;
2022
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
2023
--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.
2024
create $temp table t4(a int not null, b int, primary key(a)) select * from t2;
1 by brian
clean slate
2025
connection e;
2026
set autocommit = 0;
2027
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
2028
--send
2029
insert into t5 (select * from t2 lock in share mode);
2030
connection f;
2031
set autocommit = 0;
2032
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
2033
--send
2034
update t6 set e = (select b from t2 where a = d lock in share mode);
2035
connection g;
2036
set autocommit = 0;
2037
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
2038
--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.
2039
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
2040
connection h;
2041
set autocommit = 0;
2042
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
2043
--send
2044
insert into t8 (select * from t2 for update);
2045
connection i;
2046
set autocommit = 0;
2047
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
2048
--send
2049
update t9 set e = (select b from t2 where a = d for update);
2050
connection j;
2051
set autocommit = 0;
2052
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
2053
--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.
2054
create $temp table t10(a int not null, b int, primary key(a)) select * from t2 for update;
1 by brian
clean slate
2055
2056
connection b;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
2057
--error ER_LOCK_WAIT_TIMEOUT
1 by brian
clean slate
2058
reap;
2059
2060
connection c;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
2061
--error ER_LOCK_WAIT_TIMEOUT
1 by brian
clean slate
2062
reap;
2063
2064
connection d;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
2065
--error ER_LOCK_WAIT_TIMEOUT
1 by brian
clean slate
2066
reap;
2067
2068
connection e;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
2069
--error ER_LOCK_WAIT_TIMEOUT
1 by brian
clean slate
2070
reap;
2071
2072
connection f;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
2073
--error ER_LOCK_WAIT_TIMEOUT
1 by brian
clean slate
2074
reap;
2075
2076
connection g;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
2077
--error ER_LOCK_WAIT_TIMEOUT
1 by brian
clean slate
2078
reap;
2079
2080
connection h;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
2081
--error ER_LOCK_WAIT_TIMEOUT
1 by brian
clean slate
2082
reap;
2083
2084
connection i;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
2085
--error ER_LOCK_WAIT_TIMEOUT
1 by brian
clean slate
2086
reap;
2087
2088
connection j;
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
2089
--error ER_LOCK_WAIT_TIMEOUT
1 by brian
clean slate
2090
reap;
2091
2092
connection a;
2093
commit;
2094
2095
connection default;
2096
disconnect a;
2097
disconnect b;
2098
disconnect c;
2099
disconnect d;
2100
disconnect e;
2101
disconnect f;
2102
disconnect g;
2103
disconnect h;
2104
disconnect i;
2105
disconnect j;
2106
drop table t1, t2, t3, t5, t6, t8, t9;
2107
}
2108
# End transactional tests
2109
2110
if (test_foreign_keys)
2111
{
2112
# bug 18934, "InnoDB crashes when table uses column names like DB_ROW_ID"
2131.5.1 by kalebral at gmail
remove error numbers in tests and use enum values only
2113
--error ER_CANT_CREATE_TABLE
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.
2114
eval create $temp table t1 (DB_ROW_ID int) engine=$engine_type;
1 by brian
clean slate
2115
2116
#
2117
# Bug #17152: Wrong result with BINARY comparison on aliased column
2118
#
2119
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.
2120
eval create $temp table t1 (
1 by brian
clean slate
2121
   a BIGINT(20) NOT NULL,
2122
    PRIMARY KEY  (a)
2123
 ) ENGINE=$engine_type DEFAULT CHARSET=UTF8;
2124
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.
2125
eval create $temp table t2 (
1 by brian
clean slate
2126
  a BIGINT(20) NOT NULL,
2127
  b VARCHAR(128) NOT NULL,
2128
  c TEXT NOT NULL,
2129
  PRIMARY KEY  (a,b),
2130
  KEY idx_t2_b_c (b,c(200)),
2131
  CONSTRAINT t_fk FOREIGN KEY (a) REFERENCES t1 (a)
2132
   ON DELETE CASCADE
2133
 ) ENGINE=$engine_type DEFAULT CHARSET=UTF8;
2134
2135
INSERT INTO t1 VALUES (1);
2136
INSERT INTO t2 VALUES (1, 'bar', 'vbar');
2137
INSERT INTO t2 VALUES (1, 'BAR2', 'VBAR');
2138
INSERT INTO t2 VALUES (1, 'bar_bar', 'bibi');
2139
INSERT INTO t2 VALUES (1, 'customer_over', '1');
2140
2141
SELECT * FROM t2 WHERE b = 'customer_over';
2142
SELECT * FROM t2 WHERE BINARY b = 'customer_over';
2143
SELECT DISTINCT p0.a FROM t2 p0 WHERE p0.b = 'customer_over';
2144
/* Bang: Empty result set, above was expected: */
2145
SELECT DISTINCT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
2146
SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
2147
2148
drop table t2, t1;
2149
}
2150
2151
if ($no_spatial_key)
2152
{
2153
#
2154
# Bug #15680 (SPATIAL key in innodb)
2155
#
2156
--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.
2157
eval create $temp table t1 (g geometry not null, spatial gk(g)) engine=$engine_type;
1 by brian
clean slate
2158
}
2159
2160
#
2161
# Test optimize on table with open transaction
2162
#
2163
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.
2164
eval create $temp table t1 ( a int ) ENGINE=$engine_type;
1 by brian
clean slate
2165
BEGIN;
2166
INSERT INTO t1 VALUES (1);
1890.2.31 by Stewart Smith
myisam mix2 test relied on implicit commit in ALTER TABLE. use explicit commit instead
2167
COMMIT;
1222.1.14 by Brian Aker
Remove OPTIMIZE, place in ALTER TABLE (which does the same thing).
2168
eval ALTER TABLE t1 ENGINE=$engine_type;
1 by brian
clean slate
2169
DROP TABLE t1;
2170
2171
#######################################################################
2172
#                                                                     #
2173
# This is derivate of t/innodb.test and has to be maintained by       #
2174
# MySQL guys only.                                                    #
2175
#                                                                     #
2176
# Please synchronize this file from time to time with t/innodb.test.  #
2177
# Please, DO NOT create a toplevel testcase innodb-mix2.test, because #
2178
# innodb.test does already these tests.                               #
2179
#                                                                     #
2180
#######################################################################