~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/create.test

  • Committer: LinuxJedi
  • Date: 2010-08-12 17:36:08 UTC
  • mto: (1735.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1736.
  • Revision ID: linuxjedi@linuxjedi-laptop-20100812173608-ccr246iaa8gv3s97
Remove module pointer from registry when module doesn't load to avoid a double-free on shutdown.

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 ER_BAD_NULL_ERROR
 
17
--error 1048
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 ER_NO_SUCH_TABLE
 
29
--error 1146
30
30
create temporary table t2 engine=MEMORY select * from t1;
31
 
--error ER_NO_SUCH_TABLE
 
31
--error 1146
32
32
create table t2 select auto+1 from t1;
33
33
drop table if exists t1,t2;
34
 
--error ER_WRONG_KEY_COLUMN
 
34
--error 1167
35
35
create table t1 (b char(0) not null, index(b));
36
 
--error ER_TABLE_CANT_HANDLE_BLOB
 
36
--error 1163
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 ER_WRONG_AUTO_KEY
 
40
--error 1075
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 ER_WRONG_TABLE_NAME
 
55
--error 1103
56
56
create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int);
57
 
--error ER_TOO_LONG_IDENT
 
57
--error 1059
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 ER_INVALID_DEFAULT
 
63
--error 1067
64
64
create table t1 (a datetime default now());
65
 
--error ER_INVALID_ON_UPDATE
 
65
--error 1294
66
66
create table t1 (a datetime on update now());
67
 
--error ER_INVALID_DEFAULT
 
67
--error 1067
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 ER_INVALID_DEFAULT
 
70
#--error 1067
71
71
#create table t1 (a int default 1000);
72
 
--error ER_INVALID_DEFAULT
 
72
--error 1067
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 ER_INVALID_DEFAULT
 
78
--error 1067
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 ER_WRONG_TABLE_NAME
 
102
--error 1103
103
103
create table `` (a int);
104
 
--error ER_WRONG_TABLE_NAME
 
104
--error 1103
105
105
drop table if exists ``;
106
 
--error ER_WRONG_COLUMN_NAME
 
106
--error 1166
107
107
create table t1 (`` int);
108
 
--error ER_WRONG_NAME_FOR_INDEX
 
108
--error 1280
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 ER_DUP_FIELDNAME
 
147
--error 1060
148
148
create table t2 (a int, a float) select * from t1;               
149
149
drop table if exists t2;
150
 
--error ER_DUP_FIELDNAME
 
150
--error 1060
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 ER_DUP_FIELDNAME
 
153
--error 1060
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 ER_NO_SUCH_TABLE
 
165
--error 1146
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 ER_UNKNOWN_STORAGE_ENGINE
 
192
--error 1286
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 ER_BAD_NULL_ERROR
 
206
--error 1048
207
207
insert into t1 values ("c", NULL);
208
 
--error ER_BAD_NULL_ERROR
 
208
--error 1048
209
209
insert into t1 values (NULL, 3);
210
 
--error ER_BAD_NULL_ERROR
 
210
--error 1048
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 ER_NO_DEFAULT_FOR_FIELD
 
226
--error 1364
227
227
create table if not exists t1 select 1,2;
228
 
--error ER_WRONG_VALUE_COUNT_ON_ROW
 
228
--error 1136
229
229
create table if not exists t1 select 1,2,3,4;
230
 
--error ER_NO_DEFAULT_FOR_FIELD
 
230
--error 1364
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 ER_WRONG_TABLE_NAME
 
259
--error 1103
260
260
create table `t1 `(a int);
261
 
--error ER_WRONG_DB_NAME
 
261
--error 1102
262
262
create database `db1 `;
263
 
--error ER_WRONG_COLUMN_NAME
 
263
--error 1166
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 ER_PARSE_ERROR
 
271
--error 1064
272
272
create table t1 (a int,);
273
 
--error ER_PARSE_ERROR
 
273
--error 1064
274
274
create table t1 (a int,,b int);
275
 
--error ER_PARSE_ERROR
 
275
--error 1064
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 ER_ROW_IS_REFERENCED
 
284
--error 1217
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 ER_TABLE_EXISTS_ERROR
 
323
--error 1050
324
324
create table t3 like t1;
325
 
--error ER_TABLE_EXISTS_ERROR
 
325
--error 1050
326
326
create table t3 like mysqltest.t3;
327
 
--error ER_BAD_DB_ERROR
 
327
--error 1049
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 ER_TABLE_EXISTS_ERROR
 
331
--error 1050
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 ER_UNKNOWN_STORAGE_ENGINE
 
344
--error 1286
345
345
SET SESSION storage_engine="gemini";
346
346
SELECT @@storage_engine;
347
347
CREATE TEMPORARY TABLE t1 (a int not null);
382
382
drop table t1, t2;
383
383
 
384
384
create table t1 (a int, b int, d int, e bigint, f float(3,2), g double(4,3), h decimal(5,4), j date, k timestamp, l datetime, m enum('a','b'), o char(10));
385
 
SHOW CREATE TABLE t1;
386
385
create table t2 select ifnull(a,a), ifnull(b,b), ifnull(d,d), ifnull(e,e), ifnull(f,f), ifnull(g,g), ifnull(h,h), ifnull(j,j), ifnull(k,k), ifnull(l,l), ifnull(m,m), ifnull(o,o) from t1;
387
386
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
388
387
show create table t2;
413
412
#
414
413
 
415
414
create table t1(cenum enum('a'));
416
 
--error ER_DUPLICATED_VALUE_IN_TYPE
 
415
--error 1291
417
416
create table t2(cenum enum('a','a'));
418
 
--error ER_DUPLICATED_VALUE_IN_TYPE
 
417
--error 1291
419
418
create table t3(cenum enum('a','A','a','c','c'));
420
419
drop table t1;
421
420
 
435
434
#
436
435
 
437
436
## TODO: Is this really a bug? It works in Drizzle. Should it?
438
 
#--error ER_WRONG_NAME_FOR_INDEX
 
437
#--error 1280
439
438
#create table t1 (a int, index `primary` (a));
440
 
#--error ER_WRONG_NAME_FOR_INDEX
 
439
#--error 1280
441
440
#create table t1 (a int, index `PRIMARY` (a));
442
441
#
443
442
#create table t1 (`primary` int, index(`primary`));
448
447
#show create table t2;
449
448
#
450
449
#create table t3 (a int);
451
 
#--error ER_WRONG_NAME_FOR_INDEX
 
450
#--error 1280
452
451
#alter table t3 add index `primary` (a);
453
 
#--error ER_WRONG_NAME_FOR_INDEX
 
452
#--error 1280
454
453
#alter table t3 add index `PRIMARY` (a);
455
454
#
456
455
#create table t4 (`primary` int);
486
485
# an improper fix is present.
487
486
#
488
487
create table t1 (a int);
489
 
--error ER_UPDATE_TABLE_USED
 
488
--error 1093
490
489
create table t1 select * from t1;
491
490
## TODO: Huh? --error ER_WRONG_OBJECT
492
491
#create table t2 union = (t1) select * from t1;
497
496
#
498
497
# Bug#10413: Invalid column name is not rejected
499
498
#
500
 
--error ER_WRONG_TABLE_NAME
 
499
--error 1103
501
500
create table t1(column.name int);
502
 
--error ER_WRONG_TABLE_NAME
 
501
--error 1103
503
502
create table t1(test.column.name int);
504
 
--error ER_WRONG_DB_NAME
 
503
--error 1102
505
504
create table t1(xyz.t1.name int);
506
505
create table t1(t1.name int);
507
506
create table t2(test.t2.name int);
574
573
show create table t1;
575
574
drop table t1;
576
575
 
577
 
--error ER_NO_DEFAULT_FOR_FIELD
 
576
--error 1364
578
577
create table t1 ( 
579
578
  a varchar(12) collate utf8_bin not null, 
580
579
  b int not null, primary key (a)
1028
1027
# to be rewritten to hit the limit
1029
1028
#
1030
1029
# Ensure limit is really 64 keys
1031
 
--error ER_TOO_MANY_KEYS
 
1030
--error 1069
1032
1031
alter table t1 add key 
1033
1032
 a065_long_123456789_123456789_123456789_123456789_123456789_1234 (
1034
1033
  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16);
1042
1041
c16 int, c17 int);
1043
1042
 
1044
1043
# Get error for max key parts
1045
 
--error ER_TOO_MANY_KEY_PARTS
 
1044
--error 1070
1046
1045
alter table t1 add key i1 (
1047
1046
 c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16, c17);
1048
1047
 
1049
1048
# Get error for max key-name length
1050
 
--error ER_TOO_LONG_IDENT
 
1049
--error 1059
1051
1050
alter table t1 add key 
1052
1051
 a001_long_123456789_123456789_123456789_123456789_123456789_12345 (c1);
1053
1052
 
1152
1151
# Test incorrect database names
1153
1152
#
1154
1153
 
1155
 
--error ER_WRONG_DB_NAME
 
1154
--error 1102
1156
1155
CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
1157
 
--error ER_WRONG_DB_NAME
 
1156
--error 1102
1158
1157
DROP DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
1159
1158
 
1160
1159
# TODO: enable these tests when RENAME DATABASE is implemented.
1161
 
# --error ER_BAD_DB_ERROR
 
1160
# --error 1049
1162
1161
# RENAME DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa TO a;
1163
 
# --error ER_WRONG_DB_NAME
 
1162
# --error 1102
1164
1163
# RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
1165
1164
# create database mysqltest;
1166
 
# --error ER_WRONG_DB_NAME
 
1165
# --error 1102
1167
1166
# RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
1168
1167
# drop database mysqltest;
1169
1168
 
1170
 
--error ER_WRONG_DB_NAME
 
1169
--error 1102
1171
1170
USE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
1172
 
#--error ER_WRONG_DB_NAME
 
1171
--error 1102
1173
1172
SHOW CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
1174
1173
 
1175
1174
##
1213
1212
#
1214
1213
# Bug#25629 CREATE TABLE LIKE does not work with INFORMATION_SCHEMA
1215
1214
#
1216
 
--error ER_CANT_CREATE_TABLE
 
1215
--error 1005
1217
1216
create table t1 like data_dictionary.processlist;
1218
1217
create table t1 like data_dictionary.processlist engine=innodb;
1219
1218
show create table t1;
1220
1219
drop table t1;
1221
 
--error ER_CANT_CREATE_TABLE
 
1220
--error 1005
1222
1221
create temporary table t1 like data_dictionary.processlist;
1223
1222
create temporary table t1 like data_dictionary.processlist engine=myisam;
1224
1223
show create table t1;
1315
1314
--echo
1316
1315
 
1317
1316
CREATE TABLE t3(c1 DATETIME NOT NULL);
1318
 
--error ER_INVALID_DATETIME_VALUE # Bad datetime
 
1317
--error 1686 # Bad datetime
1319
1318
INSERT INTO t3 VALUES (0);
1320
1319
 
1321
1320
--echo