1--source include/have_innodb.inc
2
3SET NAMES utf8;
4
5CREATE TABLE t1 (
6 c1 INT PRIMARY KEY, c2 INT DEFAULT 1, ct TEXT,
7 INDEX(c2))
8ENGINE=InnoDB;
9
10INSERT INTO t1 SET c1=1;
11
12CREATE TABLE sys_tables SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
13WHERE NAME LIKE 'test/t%';
14CREATE TABLE sys_indexes SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
15INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
16
17CREATE TABLE t1p LIKE t1;
18
19CREATE TABLE t1c (c1 INT PRIMARY KEY, c2 INT, c3 INT, INDEX(c2), INDEX(c3),
20                  CONSTRAINT t1c2 FOREIGN KEY (c2) REFERENCES t1(c2),
21		  CONSTRAINT t1c3 FOREIGN KEY (c3) REFERENCES t1p(c2))
22ENGINE=InnoDB;
23
24CREATE TABLE sys_foreign SELECT i.*
25FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN i
26WHERE FOR_NAME LIKE 'test/t%';
27
28SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i
29INNER JOIN sys_foreign sf ON i.ID = sf.ID;
30
31-- source suite/innodb/include/innodb_dict.inc
32
33SHOW CREATE TABLE t1;
34ALTER TABLE t1 ALTER c2 DROP DEFAULT;
35SHOW CREATE TABLE t1;
36
37-- source suite/innodb/include/innodb_dict.inc
38
39# These should be no-op.
40ALTER TABLE t1 CHANGE c2 c2 INT AFTER c1;
41ALTER TABLE t1 CHANGE c1 c1 INT FIRST;
42
43-- source suite/innodb/include/innodb_dict.inc
44
45ALTER TABLE t1 CHANGE C2 c3 INT;
46
47-- source suite/innodb/include/innodb_dict.inc
48
49ALTER TABLE t1 CHANGE c3 C INT;
50
51-- source suite/innodb/include/innodb_dict.inc
52
53ALTER TABLE t1 CHANGE C Cöŀumň_TWO INT;
54
55SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i
56INNER JOIN sys_foreign sf ON i.ID = sf.ID;
57
58-- source suite/innodb/include/innodb_dict.inc
59
60-- error ER_BAD_FIELD_ERROR
61ALTER TABLE t1 CHANGE cöĿǖmň_two c3 INT;
62
63ALTER TABLE t1 CHANGE cÖĿUMŇ_two c3 INT, RENAME TO t3;
64
65SELECT st.NAME, i.NAME
66FROM sys_tables st INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_TABLES i
67ON i.TABLE_ID=st.TABLE_ID;
68
69SHOW CREATE TABLE t3;
70SHOW CREATE TABLE t1c;
71
72# The maximum column name length should be 64 characters.
73--error ER_TOO_LONG_IDENT
74ALTER TABLE t3 CHANGE c3
75`12345678901234567890123456789012345678901234567890123456789012345` INT;
76ALTER TABLE t3 CHANGE c3
77`1234567890123456789012345678901234567890123456789012345678901234` INT;
78SHOW CREATE TABLE t3;
79
80# Test the length limit with non-ASCII utf-8 characters.
81--error ER_TOO_LONG_IDENT
82ALTER TABLE t3 CHANGE
83`1234567890123456789012345678901234567890123456789012345678901234`
84`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾倿偀` INT;
85--error ER_TOO_LONG_IDENT
86ALTER TABLE t3 CHANGE
87`1234567890123456789012345678901234567890123456789012345678901234`
88`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾倿ä` INT;
89ALTER TABLE t3 CHANGE
90`1234567890123456789012345678901234567890123456789012345678901234`
91`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾ä` INT;
92
93# check that the rename is case-insensitive (note the upper-case ä at end)
94ALTER TABLE t3 CHANGE
95`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾Ä`
96c3 INT;
97
98# test with 4-byte UTF-8 (should be disallowed)
99--error ER_INVALID_CHARACTER_STRING
100ALTER TABLE t3 CHANGE c3 ���������������������������������������������������������� INT;
101--error ER_INVALID_CHARACTER_STRING
102ALTER TABLE t3 CHANGE c3 �� INT;
103
104ALTER TABLE t3 RENAME TO t2;
105
106SELECT st.NAME, i.NAME
107FROM sys_tables st INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_TABLES i
108ON i.TABLE_ID=st.TABLE_ID;
109
110SHOW CREATE TABLE t2;
111
112RENAME TABLE t2 TO t1;
113
114SELECT st.NAME, i.NAME
115FROM sys_tables st INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_TABLES i
116ON i.TABLE_ID=st.TABLE_ID;
117
118-- source suite/innodb/include/innodb_dict.inc
119
120--error ER_DROP_INDEX_FK
121ALTER TABLE t1 DROP INDEX c2;
122
123--error ER_CANT_DROP_FIELD_OR_KEY
124ALTER TABLE t1 DROP INDEX c4;
125
126--error ER_CANT_DROP_FIELD_OR_KEY
127ALTER TABLE t1c DROP FOREIGN KEY c2;
128
129--error ER_CANT_DROP_FIELD_OR_KEY
130ALTER TABLE t1c DROP FOREIGN KEY t1c2, DROP FOREIGN KEY c2;
131
132--error ER_CANT_DROP_FIELD_OR_KEY
133ALTER TABLE t1c DROP FOREIGN KEY t1c2, DROP FOREIGN KEY c2, DROP INDEX c2;
134
135--error ER_DROP_INDEX_FK
136ALTER TABLE t1c DROP INDEX c2;
137
138--error ER_CANT_DROP_FIELD_OR_KEY
139ALTER TABLE t1c DROP FOREIGN KEY ẗ1C2;
140
141SHOW CREATE TABLE t1c;
142
143SET foreign_key_checks=0;
144DROP TABLE t1p;
145SET foreign_key_checks=1;
146
147SHOW CREATE TABLE t1c;
148
149-- source suite/innodb/include/innodb_dict.inc
150
151CREATE TABLE t1p (c1 INT PRIMARY KEY, c2 INT, INDEX(c2)) ENGINE=InnoDB;
152
153--error ER_DROP_INDEX_FK
154ALTER TABLE t1c DROP INDEX C2, DROP INDEX C3;
155--error ER_DROP_INDEX_FK
156ALTER TABLE t1c DROP INDEX C3;
157
158SHOW CREATE TABLE t1c;
159-- source suite/innodb/include/innodb_dict.inc
160
161ALTER TABLE t1c DROP FOREIGN KEY t1C3;
162
163SHOW CREATE TABLE t1c;
164-- source suite/innodb/include/innodb_dict.inc
165
166ALTER TABLE t1c DROP INDEX c2, DROP FOREIGN KEY t1C2;
167
168SHOW CREATE TABLE t1c;
169
170-- source suite/innodb/include/innodb_dict.inc
171
172ALTER TABLE t1 DROP INDEX c2, CHANGE c3 c2 INT;
173
174-- source suite/innodb/include/innodb_dict.inc
175
176CREATE TABLE t1o LIKE t1;
177
178# This will implicitly add a FTS_DOC_ID column, which cannot be done online.
179--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
180ALTER TABLE t1 ADD FULLTEXT INDEX (ct),
181CHANGE c1 pk INT, ALTER c2 SET DEFAULT 42, RENAME TO tt,
182ALGORITHM=INPLACE, LOCK=NONE;
183
184ALTER TABLE t1 ADD FULLTEXT INDEX (ct),
185CHANGE c1 pk INT, ALTER c2 SET DEFAULT 42, RENAME TO tt,
186ALGORITHM=INPLACE, LOCK=SHARED;
187
188# The output should be empty, because index->id was reassigned.
189-- source suite/innodb/include/innodb_dict.inc
190
191SHOW CREATE TABLE tt;
192
193# DB_ROW_ID, DB_TRX_ID, DB_ROLL_PTR are reserved InnoDB system column names.
194--error ER_WRONG_COLUMN_NAME
195ALTER TABLE t1o CHANGE c1 dB_row_Id INT, ALGORITHM=COPY;
196--error ER_WRONG_COLUMN_NAME
197ALTER TABLE t1o CHANGE c1 dB_row_Id INT, ALGORITHM=INPLACE;
198--error ER_WRONG_COLUMN_NAME
199ALTER TABLE t1o CHANGE c1 DB_TRX_ID INT;
200--error ER_WRONG_COLUMN_NAME
201ALTER TABLE t1o CHANGE c1 db_roll_ptr INT;
202--error ER_WRONG_COLUMN_NAME
203ALTER TABLE t1o ADD COLUMN DB_TRX_ID INT;
204--error ER_WRONG_COLUMN_NAME
205ALTER TABLE t1o ADD COLUMN db_roll_ptr INT;
206
207--error ER_INNODB_FT_WRONG_DOCID_COLUMN
208ALTER TABLE t1o ADD FULLTEXT INDEX(ct), ADD COLUMN FTS_DOC_ID BIGINT;
209--error ER_INNODB_FT_WRONG_DOCID_COLUMN
210ALTER TABLE t1o ADD FULLTEXT INDEX(ct), ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED;
211
212ALTER TABLE t1o ADD FULLTEXT INDEX(ct),
213ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED NOT NULL;
214
215--error ER_DUP_FIELDNAME
216ALTER TABLE t1o ADD FULLTEXT INDEX(ct), ADD COLUMN FTS_DOC_ID INT;
217
218--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
219ALTER TABLE t1o DROP COLUMN FTS_DOC_ID, ALGORITHM=INPLACE;
220
221ALTER TABLE t1o DROP COLUMN FTS_DOC_ID, DROP INDEX ct, ALGORITHM=INPLACE;
222
223# This creates a hidden FTS_DOC_ID column.
224ALTER TABLE t1o ADD FULLTEXT INDEX(ct), ADD COLUMN cu TEXT;
225
226--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
227ALTER TABLE t1o ADD FULLTEXT INDEX(cu), ADD COLUMN FTS_DOC_ID BIGINT,
228ALGORITHM=INPLACE;
229--error ER_WRONG_COLUMN_NAME
230ALTER TABLE t1o ADD FULLTEXT INDEX(cu), ADD COLUMN FTS_DOC_ID BIGINT;
231--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
232ALTER TABLE t1o ADD FULLTEXT INDEX(cu), ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED,
233ALGORITHM=INPLACE;
234--error ER_WRONG_COLUMN_NAME
235ALTER TABLE t1o ADD FULLTEXT INDEX(cu), ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED;
236
237# This would drop the hidden FTS_DOC_ID column and create
238# a fulltext index on ct and another fulltext index on cu.
239--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
240ALTER TABLE t1o ADD FULLTEXT INDEX(cu),
241ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE;
242
243# Replace the hidden FTS_DOC_ID column with a user-visible one.
244# This used to work if there is at most one fulltext index.
245# Currently, we disallow native ALTER TABLE if the table
246# contains any FULLTEXT indexes.
247--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
248ALTER TABLE t1o ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
249ALGORITHM=INPLACE;
250ALTER TABLE t1o ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED NOT NULL;
251# Replace the user-visible FTS_DOC_ID column with a hidden one.
252# We do not support this in-place.
253--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
254ALTER TABLE t1o DROP COLUMN FTS_DOC_ID, ALGORITHM=INPLACE;
255ALTER TABLE t1o DROP COLUMN FTS_DOC_ID;
256
257# FTS_DOC_ID is the internal row identifier for full-text search.
258# It should be of type BIGINT UNSIGNED NOT NULL.
259--error ER_WRONG_COLUMN_NAME
260ALTER TABLE t1o ADD FULLTEXT INDEX(ct), CHANGE c1 FTS_DOC_ID INT,
261ALGORITHM=COPY;
262
263--error ER_WRONG_COLUMN_NAME
264ALTER TABLE t1o ADD FULLTEXT INDEX(ct), CHANGE c1 FTS_DOC_ID INT,
265ALGORITHM=INPLACE;
266--error ER_WRONG_COLUMN_NAME
267ALTER TABLE t1o ADD FULLTEXT INDEX(ct), CHANGE c1 FTS_Doc_ID INT,
268ALGORITHM=INPLACE;
269--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
270ALTER TABLE t1o ADD FULLTEXT INDEX(ct),
271CHANGE c1 FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
272ALGORITHM=INPLACE;
273
274CREATE TABLE t1n LIKE t1o;
275
276ALTER TABLE t1n ADD FULLTEXT INDEX(ct);
277--error ER_WRONG_COLUMN_NAME
278ALTER TABLE t1n CHANGE c1 Fts_DOC_ID INT, ALGORITHM=INPLACE;
279--error ER_WRONG_COLUMN_NAME
280ALTER TABLE t1n CHANGE c1 Fts_DOC_ID INT, ALGORITHM=COPY;
281--error ER_BAD_FIELD_ERROR
282ALTER TABLE t1n CHANGE FTS_DOC_ID c11 INT, ALGORITHM=INPLACE;
283ALTER TABLE t1n CHANGE c1 FTS_DOC_ïD INT, ALGORITHM=INPLACE;
284
285ALTER TABLE t1n CHANGE FTS_DOC_ÏD c1 INT, ALGORITHM=INPLACE;
286ALTER TABLE t1n CHANGE c1 c2 INT, CHANGE c2 ct INT, CHANGE ct c1 TEXT,
287ALGORITHM=INPLACE;
288SHOW CREATE TABLE t1n;
289ALTER TABLE t1n CHANGE c2 c1 INT, CHANGE ct c2 INT, CHANGE c1 ct TEXT,
290ALGORITHM=COPY;
291SHOW CREATE TABLE t1n;
292
293--error ER_KEY_COLUMN_DOES_NOT_EXITS
294ALTER TABLE t1n ADD INDEX(c2), CHANGE c2 c4 INT, ALGORITHM=INPLACE;
295--error ER_KEY_COLUMN_DOES_NOT_EXITS
296ALTER TABLE t1n ADD INDEX(c2), CHANGE c2 c4 INT, ALGORITHM=COPY;
297ALTER TABLE t1n ADD INDEX(c4), CHANGE c2 c4 INT, ALGORITHM=INPLACE;
298SHOW CREATE TABLE t1n;
299ALTER TABLE t1n DROP INDEX c4;
300--error ER_DUP_FIELDNAME
301ALTER TABLE t1n CHANGE c4 c1 INT, ADD INDEX(c1), ALGORITHM=INPLACE;
302ALTER TABLE t1n CHANGE c4 c11 INT, ADD INDEX(c11), ALGORITHM=INPLACE;
303
304SHOW CREATE TABLE t1n;
305DROP TABLE t1n;
306
307--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
308ALTER TABLE t1o MODIFY c1 BIGINT UNSIGNED NOT NULL, DROP INDEX ct,
309ALGORITHM=INPLACE;
310
311# This will copy the table, removing the hidden FTS_DOC_ID column.
312ALTER TABLE t1o MODIFY c1 BIGINT UNSIGNED NOT NULL, DROP INDEX ct;
313
314ALTER TABLE t1o CHANGE c1 FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
315ALGORITHM=INPLACE;
316
317ALTER TABLE t1o ADD FULLTEXT INDEX(ct), ALGORITHM=INPLACE;
318
319--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
320ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL,
321ALGORITHM=INPLACE;
322
323# This should not show duplicates.
324SELECT sc.pos FROM information_schema.innodb_sys_columns sc
325INNER JOIN information_schema.innodb_sys_tables st
326ON sc.TABLE_ID=st.TABLE_ID
327WHERE st.NAME='test/t1o' AND sc.NAME='FTS_DOC_ID';
328
329SHOW CREATE TABLE t1o;
330
331ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL,
332DROP INDEX ct, ALGORITHM=INPLACE;
333
334SHOW CREATE TABLE t1o;
335
336DROP TABLE t1c, t1p, sys_tables, sys_indexes, sys_foreign;
337
338# Check the internal schemata of tt, t1o.
339
340CREATE TABLE sys_tables SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
341WHERE NAME='test/t1o';
342CREATE TABLE sys_indexes SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
343INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
344CREATE TABLE sys_foreign SELECT i.*
345FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN i WHERE FOR_NAME='test/t1o';
346
347-- source suite/innodb/include/innodb_dict.inc
348
349# Ensure that there exists no hidden FTS_DOC_ID_INDEX on foo_id.
350
351ALTER TABLE t1o ADD UNIQUE INDEX FTS_DOC_ID_INDEX(FTS_DOC_ID),
352ADD FULLTEXT INDEX(ct),
353CHANGE foo_id FTS_DOC_ID BIGINT UNSIGNED NOT NULL;
354
355ALTER TABLE t1o DROP INDEX ct, DROP INDEX FTS_DOC_ID_INDEX,
356CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL;
357
358ALTER TABLE t1o ADD UNIQUE INDEX FTS_DOC_ID_INDEX(foo_id);
359
360ALTER TABLE t1o CHANGE foo_id FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
361ADD FULLTEXT INDEX(ct);
362
363--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
364ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL,
365ALGORITHM=INPLACE;
366
367DROP TABLE sys_indexes;
368CREATE TABLE sys_indexes SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
369INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
370
371-- source suite/innodb/include/innodb_dict.inc
372
373DROP TABLE tt, t1o, sys_tables, sys_indexes, sys_foreign;
374
375CREATE TABLE t (t TEXT, FULLTEXT(t)) ENGINE=InnoDB;
376DROP INDEX t ON t;
377LET $regexp=/FTS_([0-9a-f_]+)([A-Z_]+)/FTS_AUX_\2/;
378--replace_regex $regexp
379SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name
380FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
381WHERE name LIKE '%FTS_%' ORDER BY 1, 2;
382
383SELECT sc.pos, sc.NAME FROM information_schema.innodb_sys_columns sc
384INNER JOIN information_schema.innodb_sys_tables st
385ON sc.TABLE_ID=st.TABLE_ID
386WHERE st.NAME='test/t';
387
388ALTER TABLE t ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE;
389
390--replace_regex $regexp
391SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name
392FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
393WHERE name LIKE '%FTS_%' ORDER BY 1, 2;
394
395ALTER TABLE t ADD FULLTEXT INDEX(t);
396
397SELECT sc.pos, sc.NAME FROM information_schema.innodb_sys_columns sc
398INNER JOIN information_schema.innodb_sys_tables st
399ON sc.TABLE_ID=st.TABLE_ID
400WHERE st.NAME='test/t';
401
402DROP TABLE t;
403
404--disable_query_log
405call mtr.add_suppression("deleting orphaned .ibd file");
406--enable_query_log
407
408--echo #
409--echo # Bug #19465984 INNODB DATA DICTIONARY IS NOT UPDATED WHILE
410--echo #		RENAMING THE COLUMN
411--echo #
412CREATE TABLE t1(c1 INT NOT NULL, PRIMARY KEY(c1))ENGINE=INNODB;
413CREATE TABLE t2(c2 INT NOT NULL, FOREIGN KEY(c2) REFERENCES t1(c1))ENGINE=INNODB;
414SHOW CREATE TABLE t1;
415SHOW CREATE TABLE t2;
416ALTER TABLE t1 CHANGE COLUMN c1 C1 INT;
417SHOW CREATE TABLE t1;
418SHOW CREATE TABLE t2;
419ALTER TABLE t1 CHANGE COLUMN C1 c5 INT;
420SHOW CREATE TABLE t1;
421SHOW CREATE TABLE t2;
422DROP TABLE t2, t1;
423
424--echo #
425--echo #BUG#21514135 SCHEMA MISMATCH ERROR WHEN IMPORTING TABLESPACE AFTER
426--echo #DROPPING AN INDEX
427--echo #
428let $source_db = source_db;
429let $dest_db = dest_db;
430
431eval CREATE DATABASE $source_db;
432eval CREATE DATABASE $dest_db;
433
434eval CREATE TABLE $source_db.t1 (
435   id int(11) NOT NULL,
436   age int(11) DEFAULT NULL,
437   name varchar(20),
438   PRIMARY KEY (id),
439   KEY index1 (age)
440   ) ENGINE=InnoDB;
441
442eval ALTER TABLE $source_db.t1 DROP INDEX index1, ADD INDEX index2(name, age), algorithm=inplace;
443
444--source suite/innodb/include/import.inc
445
446eval ALTER TABLE $source_db.t1 DROP INDEX index2, algorithm=inplace;
447
448--source suite/innodb/include/import.inc
449
450eval DROP TABLE $source_db.t1;
451eval DROP DATABASE $source_db;
452eval DROP DATABASE $dest_db;
453
454--echo #
455--echo # Bug#22005726 ASSERT COL->ORD_PART IN ROW_BUILD_INDEX_ENTRY_LOW AT
456--echo # ROW0ROW.CC:299
457--echo #
458USE test;
459CREATE TABLE t1 (col1 INT, col2 TEXT) ENGINE = InnoDB;
460INSERT INTO t1 (col1, col2) VALUES (2 , 'A');
461ALTER TABLE t1 ADD KEY idx (col2(10));
462INSERT INTO t1 (col1, col2) VALUES (2 , 'A');
463--error ER_DUP_ENTRY
464ALTER TABLE t1 DROP KEY idx, ADD UNIQUE KEY uidx (col1);
465DELETE FROM t1 WHERE col1 = 2;
466DROP TABLE t1;
467
468--echo #
469--echo # BUG #26334149 MYSQL CRASHES WHEN FULL TEXT INDEXES IBD FILES ARE
470--echo # ORPHANED DUE TO RENAME TABLE
471--echo #
472CREATE DATABASE db1; USE db1;
473CREATE TABLE notes (
474   id int(11) NOT NULL AUTO_INCREMENT,
475   body text COLLATE utf8_unicode_ci,
476   PRIMARY KEY (id)
477   ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8
478COLLATE=utf8_unicode_ci;
479
480ALTER TABLE notes ADD FULLTEXT INDEX index_ft_body (body(255));
481DROP INDEX index_ft_body ON notes;
482
483CREATE DATABASE db2;
484RENAME TABLE db1.notes TO db2.notes;
485DROP DATABASE db1;
486DROP DATABASE db2;
487