~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/create.test

  • Committer: lbieber
  • Date: 2010-08-27 21:33:08 UTC
  • mfrom: (1733.2.1 staging)
  • Revision ID: lbieber@orisndriz03-20100827213308-amx6ld6by21sba7s
Merge Shrews - bug 599582
Merge Lee - use enum values instead of error numbers in tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 
15
15
create table t1 (b char(0) not null);
16
16
create table if not exists t1 (b char(0) not null);
17
 
--error 1048
 
17
--error ER_BAD_NULL_ERROR
18
18
insert into t1 values (""),(null);
19
19
select * from t1;
20
20
drop table t1;
26
26
# Test of some CREATE TABLE'S that should fail
27
27
#
28
28
 
29
 
--error 1146
 
29
--error ER_NO_SUCH_TABLE
30
30
create temporary table t2 engine=MEMORY select * from t1;
31
 
--error 1146
 
31
--error ER_NO_SUCH_TABLE
32
32
create table t2 select auto+1 from t1;
33
33
drop table if exists t1,t2;
34
 
--error 1167
 
34
--error ER_WRONG_KEY_COLUMN
35
35
create table t1 (b char(0) not null, index(b));
36
 
--error 1163
 
36
--error ER_TABLE_CANT_HANDLE_BLOB
37
37
create temporary table t1 (a int not null,b text) engine=MEMORY;
38
38
drop table if exists t1;
39
39
 
40
 
--error 1075
 
40
--error ER_WRONG_AUTO_KEY
41
41
create temporary table t1 (ordid int not null auto_increment, ord  varchar(50) not null, primary key (ord,ordid)) engine=MEMORY;
42
42
 
43
43
-- error 1049
52
52
show create table `t1`;
53
53
drop table `a/a`;
54
54
drop table `t1`;
55
 
--error 1103
 
55
--error ER_WRONG_TABLE_NAME
56
56
create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int);
57
 
--error 1059
 
57
--error ER_TOO_LONG_IDENT
58
58
create table a (`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` int);
59
59
 
60
60
#
61
61
# Some wrong defaults, so these creates should fail too (Bug #5902)
62
62
#
63
 
--error 1067
 
63
--error ER_INVALID_DEFAULT
64
64
create table t1 (a datetime default now());
65
 
--error 1294
 
65
--error ER_INVALID_ON_UPDATE
66
66
create table t1 (a datetime on update now());
67
 
--error 1067
 
67
--error ER_INVALID_DEFAULT
68
68
create table t1 (a int default 100 auto_increment);
69
69
# TODO: Should this really fail? What's wrong with default 1000 ???
70
 
#--error 1067
 
70
#--error ER_INVALID_DEFAULT
71
71
#create table t1 (a int default 1000);
72
 
--error 1067
 
72
--error ER_INVALID_DEFAULT
73
73
create table t1 (a varchar(5) default 'abcdef');
74
74
 
75
75
create table t1 (a varchar(5) default 'abcde');
76
76
insert into t1 values();
77
77
select * from t1;
78
 
--error 1067
 
78
--error ER_INVALID_DEFAULT
79
79
alter table t1 alter column a set default 'abcdef';
80
80
drop table t1;
81
81
 
99
99
drop table mysqltest.test2$;
100
100
drop database mysqltest;
101
101
 
102
 
--error 1103
 
102
--error ER_WRONG_TABLE_NAME
103
103
create table `` (a int);
104
 
--error 1103
 
104
--error ER_WRONG_TABLE_NAME
105
105
drop table if exists ``;
106
 
--error 1166
 
106
--error ER_WRONG_COLUMN_NAME
107
107
create table t1 (`` int);
108
 
--error 1280
 
108
--error ER_WRONG_NAME_FOR_INDEX
109
109
create table t1 (i int, index `` (i)); 
110
110
 
111
111
#
144
144
describe t1;
145
145
describe t2;
146
146
drop table if exists t2;
147
 
--error 1060
 
147
--error ER_DUP_FIELDNAME
148
148
create table t2 (a int, a float) select * from t1;               
149
149
drop table if exists t2;
150
 
--error 1060
 
150
--error ER_DUP_FIELDNAME
151
151
create table t2 (a int) select a as b, a+1 as b from t1;         
152
152
drop table if exists t2;
153
 
--error 1060
 
153
--error ER_DUP_FIELDNAME
154
154
create table t2 (b int) select a as b, a+1 as b from t1;         
155
155
drop table if exists t1,t2;
156
156
 
162
162
INSERT INTO t1 values (1),(2),(1);
163
163
--error ER_DUP_ENTRY
164
164
CREATE TABLE t2 (primary key(a)) SELECT * FROM t1;
165
 
--error 1146
 
165
--error ER_NO_SUCH_TABLE
166
166
SELECT * from t2;
167
167
DROP TABLE t1;
168
168
DROP TABLE IF EXISTS t2;
189
189
CREATE TEMPORARY TABLE t1 (a int not null);
190
190
show create table t1;
191
191
drop table t1;
192
 
--error 1286
 
192
--error ER_UNKNOWN_STORAGE_ENGINE
193
193
SET SESSION storage_engine="gemini";
194
194
SELECT @@storage_engine;
195
195
CREATE TEMPORARY TABLE t1 (a int not null);
203
203
#
204
204
create table t1 ( k1 varchar(2), k2 int, primary key(k1,k2));
205
205
insert into t1 values ("a", 1), ("b", 2);
206
 
--error 1048
 
206
--error ER_BAD_NULL_ERROR
207
207
insert into t1 values ("c", NULL);
208
 
--error 1048
 
208
--error ER_BAD_NULL_ERROR
209
209
insert into t1 values (NULL, 3);
210
 
--error 1048
 
210
--error ER_BAD_NULL_ERROR
211
211
insert into t1 values (NULL, NULL);
212
212
drop table t1;
213
213
 
223
223
#
224
224
 
225
225
create table t1 select 1,2,3;
226
 
--error 1364
 
226
--error ER_NO_DEFAULT_FOR_FIELD
227
227
create table if not exists t1 select 1,2;
228
 
--error 1136
 
228
--error ER_WRONG_VALUE_COUNT_ON_ROW
229
229
create table if not exists t1 select 1,2,3,4;
230
 
--error 1364
 
230
--error ER_NO_DEFAULT_FOR_FIELD
231
231
create table if not exists t1 select 1;
232
232
select * from t1;
233
233
drop table t1;
256
256
#   "Table truncated when creating another table name with Spaces"
257
257
#
258
258
 
259
 
--error 1103
 
259
--error ER_WRONG_TABLE_NAME
260
260
create table `t1 `(a int);
261
 
--error 1102
 
261
--error ER_WRONG_DB_NAME
262
262
create database `db1 `;
263
 
--error 1166
 
263
--error ER_WRONG_COLUMN_NAME
264
264
create table t1(`a ` int);
265
265
 
266
266
#
268
268
#   "Parser permits multiple commas without syntax error"
269
269
#
270
270
 
271
 
--error 1064
 
271
--error ER_PARSE_ERROR
272
272
create table t1 (a int,);
273
 
--error 1064
 
273
--error ER_PARSE_ERROR
274
274
create table t1 (a int,,b int);
275
 
--error 1064
 
275
--error ER_PARSE_ERROR
276
276
create table t1 (,b int);
277
277
 
278
278
#
281
281
 
282
282
create table t1 (a int, key(a));
283
283
create table t2 (b int, foreign key(b) references t1(a), key(b));
284
 
--error 1217
 
284
--error ER_ROW_IS_REFERENCED
285
285
drop table if exists t1,t2;
286
286
drop table if exists t2,t1;
287
287
 
320
320
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
321
321
show create table t2;
322
322
select * from t2;
323
 
--error 1050
 
323
--error ER_TABLE_EXISTS_ERROR
324
324
create table t3 like t1;
325
 
--error 1050
 
325
--error ER_TABLE_EXISTS_ERROR
326
326
create table t3 like mysqltest.t3;
327
 
--error 1049
 
327
--error ER_BAD_DB_ERROR
328
328
create table non_existing_database.t1 like t1;
329
329
--error ER_NO_SUCH_TABLE
330
330
create table t3 like non_existing_table;
331
 
--error 1050
 
331
--error ER_TABLE_EXISTS_ERROR
332
332
create temporary table t3 like t1;
333
333
drop table t1, t2, t3;
334
334
drop database mysqltest;
341
341
CREATE TEMPORARY TABLE t1 (a int not null);
342
342
show create table t1;
343
343
drop table t1;
344
 
--error 1286
 
344
--error ER_UNKNOWN_STORAGE_ENGINE
345
345
SET SESSION storage_engine="gemini";
346
346
SELECT @@storage_engine;
347
347
CREATE TEMPORARY TABLE t1 (a int not null);
412
412
#
413
413
 
414
414
create table t1(cenum enum('a'));
415
 
--error 1291
 
415
--error ER_DUPLICATED_VALUE_IN_TYPE
416
416
create table t2(cenum enum('a','a'));
417
 
--error 1291
 
417
--error ER_DUPLICATED_VALUE_IN_TYPE
418
418
create table t3(cenum enum('a','A','a','c','c'));
419
419
drop table t1;
420
420
 
434
434
#
435
435
 
436
436
## TODO: Is this really a bug? It works in Drizzle. Should it?
437
 
#--error 1280
 
437
#--error ER_WRONG_NAME_FOR_INDEX
438
438
#create table t1 (a int, index `primary` (a));
439
 
#--error 1280
 
439
#--error ER_WRONG_NAME_FOR_INDEX
440
440
#create table t1 (a int, index `PRIMARY` (a));
441
441
#
442
442
#create table t1 (`primary` int, index(`primary`));
447
447
#show create table t2;
448
448
#
449
449
#create table t3 (a int);
450
 
#--error 1280
 
450
#--error ER_WRONG_NAME_FOR_INDEX
451
451
#alter table t3 add index `primary` (a);
452
 
#--error 1280
 
452
#--error ER_WRONG_NAME_FOR_INDEX
453
453
#alter table t3 add index `PRIMARY` (a);
454
454
#
455
455
#create table t4 (`primary` int);
485
485
# an improper fix is present.
486
486
#
487
487
create table t1 (a int);
488
 
--error 1093
 
488
--error ER_UPDATE_TABLE_USED
489
489
create table t1 select * from t1;
490
490
## TODO: Huh? --error ER_WRONG_OBJECT
491
491
#create table t2 union = (t1) select * from t1;
496
496
#
497
497
# Bug#10413: Invalid column name is not rejected
498
498
#
499
 
--error 1103
 
499
--error ER_WRONG_TABLE_NAME
500
500
create table t1(column.name int);
501
 
--error 1103
 
501
--error ER_WRONG_TABLE_NAME
502
502
create table t1(test.column.name int);
503
 
--error 1102
 
503
--error ER_WRONG_DB_NAME
504
504
create table t1(xyz.t1.name int);
505
505
create table t1(t1.name int);
506
506
create table t2(test.t2.name int);
573
573
show create table t1;
574
574
drop table t1;
575
575
 
576
 
--error 1364
 
576
--error ER_NO_DEFAULT_FOR_FIELD
577
577
create table t1 ( 
578
578
  a varchar(12) collate utf8_bin not null, 
579
579
  b int not null, primary key (a)
1027
1027
# to be rewritten to hit the limit
1028
1028
#
1029
1029
# Ensure limit is really 64 keys
1030
 
--error 1069
 
1030
--error ER_TOO_MANY_KEYS
1031
1031
alter table t1 add key 
1032
1032
 a065_long_123456789_123456789_123456789_123456789_123456789_1234 (
1033
1033
  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16);
1041
1041
c16 int, c17 int);
1042
1042
 
1043
1043
# Get error for max key parts
1044
 
--error 1070
 
1044
--error ER_TOO_MANY_KEY_PARTS
1045
1045
alter table t1 add key i1 (
1046
1046
 c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16, c17);
1047
1047
 
1048
1048
# Get error for max key-name length
1049
 
--error 1059
 
1049
--error ER_TOO_LONG_IDENT
1050
1050
alter table t1 add key 
1051
1051
 a001_long_123456789_123456789_123456789_123456789_123456789_12345 (c1);
1052
1052
 
1151
1151
# Test incorrect database names
1152
1152
#
1153
1153
 
1154
 
--error 1102
 
1154
--error ER_WRONG_DB_NAME
1155
1155
CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
1156
 
--error 1102
 
1156
--error ER_WRONG_DB_NAME
1157
1157
DROP DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
1158
1158
 
1159
1159
# TODO: enable these tests when RENAME DATABASE is implemented.
1160
 
# --error 1049
 
1160
# --error ER_BAD_DB_ERROR
1161
1161
# RENAME DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa TO a;
1162
 
# --error 1102
 
1162
# --error ER_WRONG_DB_NAME
1163
1163
# RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
1164
1164
# create database mysqltest;
1165
 
# --error 1102
 
1165
# --error ER_WRONG_DB_NAME
1166
1166
# RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
1167
1167
# drop database mysqltest;
1168
1168
 
1169
 
--error 1102
 
1169
--error ER_WRONG_DB_NAME
1170
1170
USE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
1171
 
--error 1102
 
1171
--error ER_WRONG_DB_NAME
1172
1172
SHOW CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
1173
1173
 
1174
1174
##
1212
1212
#
1213
1213
# Bug#25629 CREATE TABLE LIKE does not work with INFORMATION_SCHEMA
1214
1214
#
1215
 
--error 1005
 
1215
--error ER_CANT_CREATE_TABLE
1216
1216
create table t1 like data_dictionary.processlist;
1217
1217
create table t1 like data_dictionary.processlist engine=innodb;
1218
1218
show create table t1;
1219
1219
drop table t1;
1220
 
--error 1005
 
1220
--error ER_CANT_CREATE_TABLE
1221
1221
create temporary table t1 like data_dictionary.processlist;
1222
1222
create temporary table t1 like data_dictionary.processlist engine=myisam;
1223
1223
show create table t1;
1314
1314
--echo
1315
1315
 
1316
1316
CREATE TABLE t3(c1 DATETIME NOT NULL);
1317
 
--error 1686 # Bad datetime
 
1317
--error ER_INVALID_DATETIME_VALUE # Bad datetime
1318
1318
INSERT INTO t3 VALUES (0);
1319
1319
 
1320
1320
--echo