~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to tests/t/create.test

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-10-02 14:17:48 UTC
  • mfrom: (1.1.1 upstream)
  • mto: (2.1.17 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20101002141748-m6vbfbfjhrw1153e
Tags: 2010.09.1802-1
* New upstream release.
* Removed pid-file argument hack.
* Updated GPL-2 address to be new address.
* Directly copy in drizzledump.1 since debian doesn't have sphinx 1.0 yet.
* Link to jquery from libjs-jquery. Add it as a depend.
* Add drizzled.8 symlink to the install files.

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
-- error 1049
43
44
create table not_existing_database.test (a int);
44
45
create table `a/a` (a int);
45
46
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
46
47
show create table `a/a`;
47
48
create table t1 like `a/a`;
 
49
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
 
50
show create table t1;
 
51
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
 
52
show create table `t1`;
48
53
drop table `a/a`;
49
54
drop table `t1`;
50
 
--error 1103
 
55
--error ER_WRONG_TABLE_NAME
51
56
create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int);
52
 
--error 1059
 
57
--error ER_TOO_LONG_IDENT
53
58
create table a (`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` int);
54
59
 
55
60
#
56
61
# Some wrong defaults, so these creates should fail too (Bug #5902)
57
62
#
58
 
--error 1067
 
63
--error ER_INVALID_DEFAULT
59
64
create table t1 (a datetime default now());
60
 
--error 1294
 
65
--error ER_INVALID_ON_UPDATE
61
66
create table t1 (a datetime on update now());
62
 
--error 1067
 
67
--error ER_INVALID_DEFAULT
63
68
create table t1 (a int default 100 auto_increment);
64
69
# TODO: Should this really fail? What's wrong with default 1000 ???
65
 
#--error 1067
 
70
#--error ER_INVALID_DEFAULT
66
71
#create table t1 (a int default 1000);
67
 
--error 1067
 
72
--error ER_INVALID_DEFAULT
68
73
create table t1 (a varchar(5) default 'abcdef');
69
74
 
70
75
create table t1 (a varchar(5) default 'abcde');
71
76
insert into t1 values();
72
77
select * from t1;
73
 
--error 1067
 
78
--error ER_INVALID_DEFAULT
74
79
alter table t1 alter column a set default 'abcdef';
75
80
drop table t1;
76
81
 
95
99
drop table mysqltest.test2$;
96
100
drop database mysqltest;
97
101
 
98
 
--error 1103
 
102
--error ER_WRONG_TABLE_NAME
99
103
create table `` (a int);
100
 
--error 1103
 
104
--error ER_WRONG_TABLE_NAME
101
105
drop table if exists ``;
102
 
--error 1166
 
106
--error ER_WRONG_COLUMN_NAME
103
107
create table t1 (`` int);
104
 
--error 1280
 
108
--error ER_WRONG_NAME_FOR_INDEX
105
109
create table t1 (i int, index `` (i)); 
106
110
 
107
111
#
140
144
describe t1;
141
145
describe t2;
142
146
drop table if exists t2;
143
 
--error 1060
 
147
--error ER_DUP_FIELDNAME
144
148
create table t2 (a int, a float) select * from t1;               
145
149
drop table if exists t2;
146
 
--error 1060
 
150
--error ER_DUP_FIELDNAME
147
151
create table t2 (a int) select a as b, a+1 as b from t1;         
148
152
drop table if exists t2;
149
 
--error 1060
 
153
--error ER_DUP_FIELDNAME
150
154
create table t2 (b int) select a as b, a+1 as b from t1;         
151
155
drop table if exists t1,t2;
152
156
 
158
162
INSERT INTO t1 values (1),(2),(1);
159
163
--error ER_DUP_ENTRY
160
164
CREATE TABLE t2 (primary key(a)) SELECT * FROM t1;
161
 
--error 1146
 
165
--error ER_NO_SUCH_TABLE
162
166
SELECT * from t2;
163
167
DROP TABLE t1;
164
168
DROP TABLE IF EXISTS t2;
185
189
CREATE TEMPORARY TABLE t1 (a int not null);
186
190
show create table t1;
187
191
drop table t1;
188
 
--error 1286
 
192
--error ER_UNKNOWN_STORAGE_ENGINE
189
193
SET SESSION storage_engine="gemini";
190
194
SELECT @@storage_engine;
191
195
CREATE TEMPORARY TABLE t1 (a int not null);
199
203
#
200
204
create table t1 ( k1 varchar(2), k2 int, primary key(k1,k2));
201
205
insert into t1 values ("a", 1), ("b", 2);
202
 
--error 1048
 
206
--error ER_BAD_NULL_ERROR
203
207
insert into t1 values ("c", NULL);
204
 
--error 1048
 
208
--error ER_BAD_NULL_ERROR
205
209
insert into t1 values (NULL, 3);
206
 
--error 1048
 
210
--error ER_BAD_NULL_ERROR
207
211
insert into t1 values (NULL, NULL);
208
212
drop table t1;
209
213
 
219
223
#
220
224
 
221
225
create table t1 select 1,2,3;
222
 
--error 1364
 
226
--error ER_NO_DEFAULT_FOR_FIELD
223
227
create table if not exists t1 select 1,2;
224
 
--error 1136
 
228
--error ER_WRONG_VALUE_COUNT_ON_ROW
225
229
create table if not exists t1 select 1,2,3,4;
226
 
--error 1364
 
230
--error ER_NO_DEFAULT_FOR_FIELD
227
231
create table if not exists t1 select 1;
228
232
select * from t1;
229
233
drop table t1;
252
256
#   "Table truncated when creating another table name with Spaces"
253
257
#
254
258
 
255
 
--error 1103
 
259
--error ER_WRONG_TABLE_NAME
256
260
create table `t1 `(a int);
257
 
--error 1102
 
261
--error ER_WRONG_DB_NAME
258
262
create database `db1 `;
259
 
--error 1166
 
263
--error ER_WRONG_COLUMN_NAME
260
264
create table t1(`a ` int);
261
265
 
262
266
#
264
268
#   "Parser permits multiple commas without syntax error"
265
269
#
266
270
 
267
 
--error 1064
 
271
--error ER_PARSE_ERROR
268
272
create table t1 (a int,);
269
 
--error 1064
 
273
--error ER_PARSE_ERROR
270
274
create table t1 (a int,,b int);
271
 
--error 1064
 
275
--error ER_PARSE_ERROR
272
276
create table t1 (,b int);
273
277
 
274
278
#
277
281
 
278
282
create table t1 (a int, key(a));
279
283
create table t2 (b int, foreign key(b) references t1(a), key(b));
280
 
--error 1217
 
284
--error ER_ROW_IS_REFERENCED
281
285
drop table if exists t1,t2;
282
286
drop table if exists t2,t1;
283
287
 
316
320
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
317
321
show create table t2;
318
322
select * from t2;
319
 
--error 1050
 
323
--error ER_TABLE_EXISTS_ERROR
320
324
create table t3 like t1;
321
 
--error 1050
 
325
--error ER_TABLE_EXISTS_ERROR
322
326
create table t3 like mysqltest.t3;
323
 
--error 1005
 
327
--error ER_BAD_DB_ERROR
324
328
create table non_existing_database.t1 like t1;
325
329
--error ER_NO_SUCH_TABLE
326
330
create table t3 like non_existing_table;
327
 
--error 1050
 
331
--error ER_TABLE_EXISTS_ERROR
328
332
create temporary table t3 like t1;
329
333
drop table t1, t2, t3;
330
334
drop database mysqltest;
337
341
CREATE TEMPORARY TABLE t1 (a int not null);
338
342
show create table t1;
339
343
drop table t1;
340
 
--error 1286
 
344
--error ER_UNKNOWN_STORAGE_ENGINE
341
345
SET SESSION storage_engine="gemini";
342
346
SELECT @@storage_engine;
343
347
CREATE TEMPORARY TABLE t1 (a int not null);
408
412
#
409
413
 
410
414
create table t1(cenum enum('a'));
411
 
--error 1291
 
415
--error ER_DUPLICATED_VALUE_IN_TYPE
412
416
create table t2(cenum enum('a','a'));
413
 
--error 1291
 
417
--error ER_DUPLICATED_VALUE_IN_TYPE
414
418
create table t3(cenum enum('a','A','a','c','c'));
415
419
drop table t1;
416
420
 
430
434
#
431
435
 
432
436
## TODO: Is this really a bug? It works in Drizzle. Should it?
433
 
#--error 1280
 
437
#--error ER_WRONG_NAME_FOR_INDEX
434
438
#create table t1 (a int, index `primary` (a));
435
 
#--error 1280
 
439
#--error ER_WRONG_NAME_FOR_INDEX
436
440
#create table t1 (a int, index `PRIMARY` (a));
437
441
#
438
442
#create table t1 (`primary` int, index(`primary`));
443
447
#show create table t2;
444
448
#
445
449
#create table t3 (a int);
446
 
#--error 1280
 
450
#--error ER_WRONG_NAME_FOR_INDEX
447
451
#alter table t3 add index `primary` (a);
448
 
#--error 1280
 
452
#--error ER_WRONG_NAME_FOR_INDEX
449
453
#alter table t3 add index `PRIMARY` (a);
450
454
#
451
455
#create table t4 (`primary` int);
481
485
# an improper fix is present.
482
486
#
483
487
create table t1 (a int);
484
 
--error 1093
 
488
--error ER_UPDATE_TABLE_USED
485
489
create table t1 select * from t1;
486
490
## TODO: Huh? --error ER_WRONG_OBJECT
487
491
#create table t2 union = (t1) select * from t1;
492
496
#
493
497
# Bug#10413: Invalid column name is not rejected
494
498
#
495
 
--error 1103
 
499
--error ER_WRONG_TABLE_NAME
496
500
create table t1(column.name int);
497
 
--error 1103
 
501
--error ER_WRONG_TABLE_NAME
498
502
create table t1(test.column.name int);
499
 
--error 1102
 
503
--error ER_WRONG_DB_NAME
500
504
create table t1(xyz.t1.name int);
501
505
create table t1(t1.name int);
502
506
create table t2(test.t2.name int);
569
573
show create table t1;
570
574
drop table t1;
571
575
 
572
 
--error 1364
 
576
--error ER_NO_DEFAULT_FOR_FIELD
573
577
create table t1 ( 
574
578
  a varchar(12) collate utf8_bin not null, 
575
579
  b int not null, primary key (a)
1023
1027
# to be rewritten to hit the limit
1024
1028
#
1025
1029
# Ensure limit is really 64 keys
1026
 
--error 1069
 
1030
--error ER_TOO_MANY_KEYS
1027
1031
alter table t1 add key 
1028
1032
 a065_long_123456789_123456789_123456789_123456789_123456789_1234 (
1029
1033
  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16);
1037
1041
c16 int, c17 int);
1038
1042
 
1039
1043
# Get error for max key parts
1040
 
--error 1070
 
1044
--error ER_TOO_MANY_KEY_PARTS
1041
1045
alter table t1 add key i1 (
1042
1046
 c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16, c17);
1043
1047
 
1044
1048
# Get error for max key-name length
1045
 
--error 1059
 
1049
--error ER_TOO_LONG_IDENT
1046
1050
alter table t1 add key 
1047
1051
 a001_long_123456789_123456789_123456789_123456789_123456789_12345 (c1);
1048
1052
 
1147
1151
# Test incorrect database names
1148
1152
#
1149
1153
 
1150
 
--error 1102
 
1154
--error ER_WRONG_DB_NAME
1151
1155
CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
1152
 
--error 1102
 
1156
--error ER_WRONG_DB_NAME
1153
1157
DROP DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
1154
1158
 
1155
1159
# TODO: enable these tests when RENAME DATABASE is implemented.
1156
 
# --error 1049
 
1160
# --error ER_BAD_DB_ERROR
1157
1161
# RENAME DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa TO a;
1158
 
# --error 1102
 
1162
# --error ER_WRONG_DB_NAME
1159
1163
# RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
1160
1164
# create database mysqltest;
1161
 
# --error 1102
 
1165
# --error ER_WRONG_DB_NAME
1162
1166
# RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
1163
1167
# drop database mysqltest;
1164
1168
 
1165
 
--error 1102
 
1169
--error ER_WRONG_DB_NAME
1166
1170
USE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
1167
 
--error 1102
 
1171
--error ER_WRONG_DB_NAME
1168
1172
SHOW CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
1169
1173
 
1170
1174
##
1208
1212
#
1209
1213
# Bug#25629 CREATE TABLE LIKE does not work with INFORMATION_SCHEMA
1210
1214
#
1211
 
--error 1005
 
1215
--error ER_CANT_CREATE_TABLE
1212
1216
create table t1 like data_dictionary.processlist;
1213
1217
create table t1 like data_dictionary.processlist engine=innodb;
1214
1218
show create table t1;
1215
1219
drop table t1;
1216
 
--error 1005
 
1220
--error ER_CANT_CREATE_TABLE
1217
1221
create temporary table t1 like data_dictionary.processlist;
1218
1222
create temporary table t1 like data_dictionary.processlist engine=myisam;
1219
1223
show create table t1;
1243
1247
  c4 VARCHAR(255) NOT NULL DEFAULT 'a',
1244
1248
  c5 VARCHAR(255) COLLATE utf8_unicode_ci NULL DEFAULT 'b',
1245
1249
  c6 VARCHAR(255))
1246
 
  COLLATE utf8_bin;
 
1250
  COLLATE=utf8_bin;
1247
1251
 
1248
1252
--echo
1249
1253
 
1310
1314
--echo
1311
1315
 
1312
1316
CREATE TABLE t3(c1 DATETIME NOT NULL);
1313
 
--error 1686 # Bad datetime
 
1317
--error ER_INVALID_DATETIME_VALUE # Bad datetime
1314
1318
INSERT INTO t3 VALUES (0);
1315
1319
 
1316
1320
--echo