Skip to content

Commit 6f70743

Browse files
committed
cleanup: copy RAII helpers from 10.5, cleanup test
1 parent 4568a72 commit 6f70743

File tree

4 files changed

+114
-76
lines changed

4 files changed

+114
-76
lines changed

mysql-test/r/create.result

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
call mtr.add_suppression("table or database name 't-1'");
2-
drop table if exists t1,t2,t3,t4,t5;
3-
drop database if exists mysqltest;
4-
drop view if exists v1;
52
create table t1 (b char(0));
63
insert into t1 values (""),(null);
74
select * from t1;
@@ -2066,10 +2063,21 @@ alter table t1 add
20662063
key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0064 (f64) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy';
20672064
ERROR HY000: Cannot create table `t1`: index information is too long. Decrease number of indexes or use shorter index names or shorter comments.
20682065
drop table t1;
2069-
End of 5.5 tests
2066+
#
2067+
# End of 5.5 tests
2068+
#
2069+
#
2070+
# MDEV-4880 Attempt to create a table without columns produces ER_ILLEGAL_HA instead of ER_TABLE_MUST_HAVE_COLUMNS
2071+
#
20702072
create table t1;
20712073
ERROR 42000: A table must have at least 1 column
2074+
#
2075+
# MDEV-11231 Server crashes in check_duplicate_key on CREATE TABLE ... SELECT
2076+
#
20722077
create table t1 (i int, j int, key(i), key(i)) as select 1 as i, 2 as j;
20732078
Warnings:
20742079
Note 1831 Duplicate index `i_2`. This is deprecated and will be disallowed in a future release
20752080
drop table t1;
2081+
#
2082+
# End of 10.0 tests
2083+
#

mysql-test/t/create.test

Lines changed: 69 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ call mtr.add_suppression("table or database name 't-1'");
55
# Check some special create statements.
66
#
77

8-
--disable_warnings
9-
drop table if exists t1,t2,t3,t4,t5;
10-
drop database if exists mysqltest;
11-
drop view if exists v1;
12-
--enable_warnings
13-
148
create table t1 (b char(0));
159
insert into t1 values (""),(null);
1610
select * from t1;
@@ -29,30 +23,30 @@ drop table t1;
2923
# Test of some CREATE TABLE'S that should fail
3024
#
3125

32-
--error 1146
26+
--error ER_NO_SUCH_TABLE
3327
create table t2 engine=heap select * from t1;
34-
--error 1146
28+
--error ER_NO_SUCH_TABLE
3529
create table t2 select auto+1 from t1;
3630
drop table if exists t1,t2;
37-
--error 1167
31+
--error ER_WRONG_KEY_COLUMN
3832
create table t1 (b char(0) not null, index(b));
39-
--error 1163
33+
--error ER_TABLE_CANT_HANDLE_BLOB
4034
create table t1 (a int not null,b text) engine=heap;
4135
drop table if exists t1;
4236

43-
--error 1075
37+
--error ER_WRONG_AUTO_KEY
4438
create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) engine=heap;
4539

46-
-- error 1049
40+
--error ER_BAD_DB_ERROR
4741
create table not_existing_database.test (a int);
4842
create table `a/a` (a int);
4943
show create table `a/a`;
5044
create table t1 like `a/a`;
5145
drop table `a/a`;
5246
drop table `t1`;
53-
--error 1103
47+
--error ER_WRONG_TABLE_NAME
5448
create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int);
55-
--error 1059
49+
--error ER_TOO_LONG_IDENT
5650
create table a (`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` int);
5751

5852
#
@@ -62,17 +56,17 @@ create table t1 (a datetime default now());
6256
drop table t1;
6357
create table t1 (a datetime on update now());
6458
drop table t1;
65-
--error 1067
59+
--error ER_INVALID_DEFAULT
6660
create table t1 (a int default 100 auto_increment);
67-
--error 1067
61+
--error ER_INVALID_DEFAULT
6862
create table t1 (a tinyint default 1000);
69-
--error 1067
63+
--error ER_INVALID_DEFAULT
7064
create table t1 (a varchar(5) default 'abcdef');
7165

7266
create table t1 (a varchar(5) default 'abcde');
7367
insert into t1 values();
7468
select * from t1;
75-
--error 1067
69+
--error ER_INVALID_DEFAULT
7670
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
7771
alter table t1 alter column a set default 'abcdef';
7872
drop table t1;
@@ -97,13 +91,13 @@ create table mysqltest.test2$ (a int);
9791
drop table mysqltest.test2$;
9892
drop database mysqltest;
9993

100-
--error 1103
94+
--error ER_WRONG_TABLE_NAME
10195
create table `` (a int);
102-
--error 1103
96+
--error ER_WRONG_TABLE_NAME
10397
drop table if exists ``;
104-
--error 1166
98+
--error ER_WRONG_COLUMN_NAME
10599
create table t1 (`` int);
106-
--error 1280
100+
--error ER_WRONG_NAME_FOR_INDEX
107101
create table t1 (i int, index `` (i));
108102

109103
#
@@ -158,13 +152,13 @@ create table t2 (a int) select * from t1;
158152
describe t1;
159153
describe t2;
160154
drop table if exists t2;
161-
--error 1060
155+
--error ER_DUP_FIELDNAME
162156
create table t2 (a int, a float) select * from t1;
163157
drop table if exists t2;
164-
--error 1060
158+
--error ER_DUP_FIELDNAME
165159
create table t2 (a int) select a as b, a+1 as b from t1;
166160
drop table if exists t2;
167-
--error 1060
161+
--error ER_DUP_FIELDNAME
168162
create table t2 (b int) select a as b, a+1 as b from t1;
169163
drop table if exists t1,t2;
170164

@@ -176,7 +170,7 @@ CREATE TABLE t1 (a int not null);
176170
INSERT INTO t1 values (1),(2),(1);
177171
--error ER_DUP_ENTRY
178172
CREATE TABLE t2 (primary key(a)) SELECT * FROM t1;
179-
--error 1146
173+
--error ER_NO_SUCH_TABLE
180174
SELECT * from t2;
181175
DROP TABLE t1;
182176
DROP TABLE IF EXISTS t2;
@@ -202,7 +196,7 @@ SELECT @@storage_engine;
202196
CREATE TABLE t1 (a int not null);
203197
show create table t1;
204198
drop table t1;
205-
--error 1286
199+
--error ER_UNKNOWN_STORAGE_ENGINE
206200
SET SESSION storage_engine="gemini";
207201
SELECT @@storage_engine;
208202
CREATE TABLE t1 (a int not null);
@@ -216,11 +210,11 @@ drop table t1;
216210
#
217211
create table t1 ( k1 varchar(2), k2 int, primary key(k1,k2));
218212
insert into t1 values ("a", 1), ("b", 2);
219-
--error 1048
213+
--error ER_BAD_NULL_ERROR
220214
insert into t1 values ("c", NULL);
221-
--error 1048
215+
--error ER_BAD_NULL_ERROR
222216
insert into t1 values (NULL, 3);
223-
--error 1048
217+
--error ER_BAD_NULL_ERROR
224218
insert into t1 values (NULL, NULL);
225219
drop table t1;
226220

@@ -262,23 +256,23 @@ drop table t1;
262256
# "Table truncated when creating another table name with Spaces"
263257
#
264258

265-
--error 1103
259+
--error ER_WRONG_TABLE_NAME
266260
create table `t1 `(a int);
267-
--error 1102
261+
--error ER_WRONG_DB_NAME
268262
create database `db1 `;
269-
--error 1166
263+
--error ER_WRONG_COLUMN_NAME
270264
create table t1(`a ` int);
271265

272266
#
273267
# Test for Bug #3481
274268
# "Parser permits multiple commas without syntax error"
275269
#
276270

277-
--error 1064
271+
--error ER_PARSE_ERROR
278272
create table t1 (a int,);
279-
--error 1064
273+
--error ER_PARSE_ERROR
280274
create table t1 (a int,,b int);
281-
--error 1064
275+
--error ER_PARSE_ERROR
282276
create table t1 (,b int);
283277

284278
#
@@ -320,13 +314,13 @@ create table t2 like t3;
320314
show create table t2;
321315
select * from t2;
322316
create table t3 like t1;
323-
--error 1050
317+
--error ER_TABLE_EXISTS_ERROR
324318
create table t3 like mysqltest.t3;
325-
--error 1049
319+
--error ER_BAD_DB_ERROR
326320
create table non_existing_database.t1 like t1;
327321
--error ER_NO_SUCH_TABLE
328322
create table t3 like non_existing_table;
329-
--error 1050
323+
--error ER_TABLE_EXISTS_ERROR
330324
create temporary table t3 like t1;
331325
drop table t1, t2, t3;
332326
drop table t3;
@@ -360,7 +354,7 @@ SELECT @@storage_engine;
360354
CREATE TABLE t1 (a int not null);
361355
show create table t1;
362356
drop table t1;
363-
--error 1286
357+
--error ER_UNKNOWN_STORAGE_ENGINE
364358
SET SESSION storage_engine="gemini";
365359
SELECT @@storage_engine;
366360
CREATE TABLE t1 (a int not null);
@@ -464,9 +458,9 @@ use test;
464458
# Test for Bug 856 'Naming a key "Primary" causes trouble'
465459
#
466460

467-
--error 1280
461+
--error ER_WRONG_NAME_FOR_INDEX
468462
create table t1 (a int, index `primary` (a));
469-
--error 1280
463+
--error ER_WRONG_NAME_FOR_INDEX
470464
create table t1 (a int, index `PRIMARY` (a));
471465

472466
create table t1 (`primary` int, index(`primary`));
@@ -475,9 +469,9 @@ create table t2 (`PRIMARY` int, index(`PRIMARY`));
475469
show create table t2;
476470

477471
create table t3 (a int);
478-
--error 1280
472+
--error ER_WRONG_NAME_FOR_INDEX
479473
alter table t3 add index `primary` (a);
480-
--error 1280
474+
--error ER_WRONG_NAME_FOR_INDEX
481475
alter table t3 add index `PRIMARY` (a);
482476

483477
create table t4 (`primary` int);
@@ -532,11 +526,11 @@ drop table t1;
532526
#
533527
# Bug#10413: Invalid column name is not rejected
534528
#
535-
--error 1103
529+
--error ER_WRONG_TABLE_NAME
536530
create table t1(column.name int);
537-
--error 1103
531+
--error ER_WRONG_TABLE_NAME
538532
create table t1(test.column.name int);
539-
--error 1102
533+
--error ER_WRONG_DB_NAME
540534
create table t1(xyz.t1.name int);
541535
create table t1(t1.name int);
542536
create table t2(test.t2.name int);
@@ -575,7 +569,7 @@ drop table if exists test.t1;
575569
create database mysqltest;
576570
use mysqltest;
577571
create view v1 as select 'foo' from dual;
578-
--error 1347
572+
--error ER_WRONG_OBJECT
579573
create table t1 like v1;
580574
drop view v1;
581575
drop database mysqltest;
@@ -696,7 +690,7 @@ drop table t1, t2;
696690
#
697691
# Bug #15316 SET value having comma not correctly handled
698692
#
699-
--error 1367
693+
--error ER_ILLEGAL_VALUE_FOR_TYPE
700694
create table t1(a set("a,b","c,d") not null);
701695

702696
# End of 4.1 tests
@@ -894,9 +888,9 @@ INSERT IGNORE INTO t1 (b) VALUES (5);
894888

895889
CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
896890
SELECT a FROM t1;
897-
--error 1062
891+
--error ER_DUP_ENTRY
898892
INSERT INTO t2 SELECT a FROM t1;
899-
--error 1062
893+
--error ER_DUP_ENTRY
900894
INSERT INTO t2 SELECT a FROM t1;
901895

902896
DROP TABLE t1, t2;
@@ -956,24 +950,24 @@ drop table t1,t2;
956950
# Test incorrect database names
957951
#
958952

959-
--error 1102
953+
--error ER_WRONG_DB_NAME
960954
CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
961-
--error 1102
955+
--error ER_WRONG_DB_NAME
962956
DROP DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
963957

964958
# TODO: enable these tests when RENAME DATABASE is implemented.
965-
# --error 1049
959+
# --error ER_BAD_DB_ERROR
966960
# RENAME DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa TO a;
967-
# --error 1102
961+
# --error ER_WRONG_DB_NAME
968962
# RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
969963
# create database mysqltest;
970-
# --error 1102
964+
# --error ER_WRONG_DB_NAME
971965
# RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
972966
# drop database mysqltest;
973967

974-
--error 1102
968+
--error ER_WRONG_DB_NAME
975969
USE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
976-
--error 1102
970+
--error ER_WRONG_DB_NAME
977971
SHOW CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
978972

979973
#
@@ -1025,11 +1019,11 @@ before insert on имя_таблицы_в_кодировке_утф8_длино
10251019
select TRIGGER_NAME from information_schema.triggers where
10261020
trigger_schema='test';
10271021
drop trigger имя_триггера_в_кодировке_утф8_длиной_больше_чем_49;
1028-
--error 1059
1022+
--error ER_TOO_LONG_IDENT
10291023
create trigger
10301024
очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66
10311025
before insert on имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48 for each row set @a:=1;
1032-
--error 1059
1026+
--error ER_TOO_LONG_IDENT
10331027
drop trigger очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66;
10341028

10351029
create procedure имя_процедуры_в_кодировке_утф8_длиной_больше_чем_50()
@@ -1038,7 +1032,7 @@ end;
10381032
select ROUTINE_NAME from information_schema.routines where
10391033
routine_schema='test';
10401034
drop procedure имя_процедуры_в_кодировке_утф8_длиной_больше_чем_50;
1041-
--error 1059
1035+
--error ER_TOO_LONG_IDENT
10421036
create procedure очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66()
10431037
begin
10441038
end;
@@ -1049,7 +1043,7 @@ return 0;
10491043
select ROUTINE_NAME from information_schema.routines where
10501044
routine_schema='test';
10511045
drop function имя_функции_в_кодировке_утф8_длиной_больше_чем_49;
1052-
--error 1059
1046+
--error ER_TOO_LONG_IDENT
10531047
create function очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66()
10541048
returns int
10551049
return 0;
@@ -1917,16 +1911,22 @@ alter table t1 add
19171911
key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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echo #
1915+
--echo # End of 5.5 tests
1916+
--echo #
19211917

1922-
#
1923-
# MDEV-4880 Attempt to create a table without columns produces ER_ILLEGAL_HA instead of ER_TABLE_MUST_HAVE_COLUMNS
1924-
#
1918+
--echo #
1919+
--echo # MDEV-4880 Attempt to create a table without columns produces ER_ILLEGAL_HA instead of ER_TABLE_MUST_HAVE_COLUMNS
1920+
--echo #
19251921
--error ER_TABLE_MUST_HAVE_COLUMNS
19261922
create table t1;
19271923

1928-
#
1929-
# MDEV-11231 Server crashes in check_duplicate_key on CREATE TABLE ... SELECT
1930-
#
1924+
--echo #
1925+
--echo # MDEV-11231 Server crashes in check_duplicate_key on CREATE TABLE ... SELECT
1926+
--echo #
19311927
create table t1 (i int, j int, key(i), key(i)) as select 1 as i, 2 as j;
19321928
drop table t1;
1929+
1930+
--echo #
1931+
--echo # End of 10.0 tests
1932+
--echo #

0 commit comments

Comments
 (0)