Debian Codegraph @

mysql-test/suite/ndb/r/ndb_alter_table_online.result

raw
1 *******************************
2 * basic online alter tests
3 *******************************
4 CREATE TABLE t1 (a INT UNSIGNED KEY, b INT UNSIGNED) ROW_FORMAT=DYNAMIC ENGINE NDB;
5 INSERT INTO t1 values (1,1);
6 set @t1_id = (select id from ndb_show_tables_results where name like '%t1%' and type like '%UserTable%');
7 *******************************
8 * Alter Table online add column
9 *******************************
10 * Add column c as CHAR
11 *******************************
12 ALTER TABLE t1 ADD c CHAR(19);
13 select name from ndb_show_tables_results where id = @t1_id and name like '%t1%' and type like '%UserTable%';
14 name
15 't1'
16 INSERT INTO t1 values (2,1,"a");
17 SELECT * FROM t1 ORDER BY a;
18 a b c
19 1 1 NULL
20 2 1 a
21 UPDATE t1 SET c='b' where a = 2;
22 SELECT * FROM t1 ORDER BY a;
23 a b c
24 1 1 NULL
25 2 1 b
26 DROP TABLE t1;
27 *******************************
28 * Alter Table online add column
29 *******************************
30 * Add column c as nullable INT
31 *******************************
32 CREATE TABLE t1 (a INT UNSIGNED KEY, b VARCHAR(19)) ENGINE NDB;
33 INSERT INTO t1 values (1,"a");
34 set @t1_id = (select id from ndb_show_tables_results where name like '%t1%' and type like '%UserTable%');
35 ALTER TABLE t1 ADD c INT;
36 Warnings:
37 Warning 1478 Converted FIXED field 'c' to DYNAMIC to enable online ADD COLUMN
38 select name from ndb_show_tables_results where id = @t1_id and name like '%t1%' and type like '%UserTable%';
39 name
40 't1'
41 INSERT INTO t1 values (2,"a",1);
42 SELECT * FROM t1 ORDER BY a;
43 a b c
44 1 a NULL
45 2 a 1
46 UPDATE t1 SET c = 2 where a = 2;
47 SELECT * FROM t1 ORDER BY a;
48 a b c
49 1 a NULL
50 2 a 2
51 DROP TABLE t1;
52 *******************************
53 * Alter Table online add column
54 *******************************
55 * Add column c as nullable INT
56 *******************************
57 CREATE TABLE t1 (a INT UNSIGNED KEY, b INT COLUMN_FORMAT DYNAMIC) ENGINE NDB;
58 INSERT INTO t1 values (1,1);
59 set @t1_id = (select id from ndb_show_tables_results where name like '%t1%' and type like '%UserTable%');
60 ALTER TABLE t1 ADD c INT;
61 Warnings:
62 Warning 1478 Converted FIXED field 'c' to DYNAMIC to enable online ADD COLUMN
63 select name from ndb_show_tables_results where id = @t1_id and name like '%t1%' and type like '%UserTable%';
64 name
65 't1'
66 INSERT INTO t1 values (2,1,1);
67 SELECT * FROM t1 ORDER BY a;
68 a b c
69 1 1 NULL
70 2 1 1
71 UPDATE t1 SET c = 2 where a = 2;
72 SELECT * FROM t1 ORDER BY a;
73 a b c
74 1 1 NULL
75 2 1 2
76 *******************************
77 * Create online Index ci
78 *******************************
79 CREATE INDEX ci on t1(c) algorithm=inplace;
80 select name from ndb_show_tables_results where id = @t1_id and name like '%t1%' and type like '%UserTable%';
81 name
82 't1'
83 *******************************
84 * Create offline Index ci2
85 *******************************
86 CREATE INDEX ci2 on t1(c) algorithm=copy;
87 Warnings:
88 Warning 1831 Duplicate index 'ci2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
89 select name from ndb_show_tables_results where id = @t1_id and name like '%t1%' and type like '%UserTable%';
90 name
91 set @t1_id = (select id from ndb_show_tables_results where name like '%t1%' and type like '%UserTable%');
92 *******************************
93 * Drop online Index ci
94 *******************************
95 DROP INDEX ci on t1 algorithm=inplace;
96 select name from ndb_show_tables_results where id = @t1_id and name like '%t1%' and type like '%UserTable%';
97 name
98 't1'
99 *******************************
100 * Drop offline Index ci2
101 *******************************
102 DROP INDEX ci2 on t1 algorithm=copy;
103 select name from ndb_show_tables_results where id = @t1_id and name like '%t1%' and type like '%UserTable%';
104 name
105 DROP TABLE t1;
106 *******************************
107 * Add column c as NULLABLE TIMESTAMP online
108 *******************************
109 CREATE TABLE t1 (a INT UNSIGNED KEY, b INT UNSIGNED) ROW_FORMAT=DYNAMIC ENGINE NDB;
110 INSERT INTO t1 values (1,1);
111 set @t1_id = (select id from ndb_show_tables_results where name like '%t1%' and type like '%UserTable%');
112 ALTER TABLE t1 algorithm=inplace, ADD c TIMESTAMP;
113 select name from ndb_show_tables_results where id = @t1_id and name like '%t1%' and type like '%UserTable%';
114 name
115 't1'
116 INSERT INTO t1 values (2,2,'2007-09-19 18:46:02');
117 SELECT * FROM t1 ORDER BY a;
118 a b c
119 1 1 NULL
120 2 2 2007-09-19 18:46:02
121 UPDATE t1 SET c = '2007-10-22 16:35:06' where a = 2;
122 SELECT * FROM t1 ORDER BY a;
123 a b c
124 1 1 NULL
125 2 2 2007-10-22 16:35:06
126 DROP TABLE t1;
127 *******************************
128 * The following ALTER operations are not supported on-line
129 *******************************
130 * Not supported Test#1
131 *******************************
132 CREATE TABLE t1 (a INT UNSIGNED KEY, b INT UNSIGNED) ROW_FORMAT=FIXED ENGINE NDB;
133 INSERT INTO t1 values (1,1);
134 set @t1_id = (select id from ndb_show_tables_results where name like '%t1%' and type like '%UserTable%');
135 ALTER TABLE t1 algorithm=inplace, ADD c CHAR(19);
136 ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Adding column(s) or add/reorganize partition not supported online. Try ALGORITHM=COPY.
137 select name from ndb_show_tables_results where id = @t1_id and name like '%t1%' and type like '%UserTable%';
138 name
139 't1'
140 ALTER TABLE t1 ADD c CHAR(19);
141 INSERT INTO t1 values (2,1,"a");
142 SELECT * FROM t1 ORDER BY a;
143 a b c
144 1 1 NULL
145 2 1 a
146 UPDATE t1 SET c = 'b' where a = 2;
147 SELECT * FROM t1 ORDER BY a;
148 a b c
149 1 1 NULL
150 2 1 b
151 DROP TABLE t1;
152 *******************************
153 * Not supported Test#2
154 *******************************
155 CREATE TABLE t1 (a INT UNSIGNED KEY, b INT UNSIGNED) ROW_FORMAT=DYNAMIC ENGINE NDB;
156 INSERT INTO t1 values (1,1);
157 set @t1_id = (select id from ndb_show_tables_results where name like '%t1%' and type like '%UserTable%');
158 ALTER TABLE t1 algorithm=inplace, ADD c CHAR(19) DEFAULT 17;
159 ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Adding column with non-null default value is not supported online. Try ALGORITHM=COPY.
160 select name from ndb_show_tables_results where id = @t1_id and name like '%t1%' and type like '%UserTable%';
161 name
162 't1'
163 ALTER TABLE t1 ADD c CHAR(19) DEFAULT 17;
164 INSERT INTO t1 values (2,1,"a");
165 SELECT * FROM t1 ORDER BY a;
166 a b c
167 1 1 17
168 2 1 a
169 UPDATE t1 SET c = 'b' where a = 2;
170 SELECT * FROM t1 ORDER BY a;
171 a b c
172 1 1 17
173 2 1 b
174 *******************************
175 * Not supported Test#3
176 *******************************
177 set @t1_id = (select id from ndb_show_tables_results where name like '%t1%' and type like '%UserTable%');
178 ALTER TABLE t1 algorithm=inplace, ADD d INT AFTER b;
179 ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Altering column order. Try ALGORITHM=COPY.
180 select name from ndb_show_tables_results where id = @t1_id and name like '%t1%' and type like '%UserTable%';
181 name
182 't1'
183 ALTER TABLE t1 ADD d INT AFTER b;
184 select name from ndb_show_tables_results where id = @t1_id and name like '%t1%' and type like '%UserTable%';
185 name
186 INSERT INTO t1 VALUES(3,1,1,'b');
187 SELECT * FROM t1 ORDER BY a;
188 a b d c
189 1 1 NULL 17
190 2 1 NULL b
191 3 1 1 b
192 UPDATE t1 SET d = 2 where a = 3;
193 SELECT * FROM t1 ORDER BY a;
194 a b d c
195 1 1 NULL 17
196 2 1 NULL b
197 3 1 2 b
198 *******************************
199 * Not supported Test#4
200 *******************************
201 set @t1_id = (select id from ndb_show_tables_results where name like '%t1%' and type like '%UserTable%');
202 ALTER TABLE t1 algorithm=inplace, ENGINE MYISAM;
203 ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
204 select name from ndb_show_tables_results where id = @t1_id and name like '%t1%' and type like '%UserTable%';
205 name
206 't1'
207 DROP TABLE t1;
208 *******************************
209 * Not supported Test#5
210 *******************************
211 CREATE TABLE t1 (a INT UNSIGNED KEY, b INT UNSIGNED) ROW_FORMAT=DYNAMIC ENGINE NDB;
212 INSERT INTO t1 values (1,1);
213 set @t1_id = (select id from ndb_show_tables_results where name like '%t1%' and type like '%UserTable%');
214 ALTER TABLE t1 algorithm=inplace, ADD c CHAR(19) NOT NULL;
215 ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Adding column(s) or add/reorganize partition not supported online. Try ALGORITHM=COPY.
216 select name from ndb_show_tables_results where id = @t1_id and name like '%t1%' and type like '%UserTable%';
217 name
218 't1'
219 ALTER TABLE t1 ADD c CHAR(19) NOT NULL;
220 INSERT INTO t1 values (2,1,"a");
221 SELECT * FROM t1 ORDER BY a;
222 a b c
223 1 1
224 2 1 a
225 UPDATE t1 SET c = 'b' where a = 2;
226 SELECT * FROM t1 ORDER BY a;
227 a b c
228 1 1
229 2 1 b
230 DROP TABLE t1;
231 *******************************
232 * Not supported Test#6
233 *******************************
234 CREATE TABLE t1 (a INT UNSIGNED KEY, b INT UNSIGNED) ROW_FORMAT=DYNAMIC ENGINE NDB;
235 INSERT INTO t1 values (1,1);
236 set @t1_id = (select id from ndb_show_tables_results where name like '%t1%' and type like '%UserTable%');
237 ALTER TABLE t1 algorithm=inplace, ADD c CHAR(19) COLUMN_FORMAT FIXED;
238 ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Adding column(s) or add/reorganize partition not supported online. Try ALGORITHM=COPY.
239 select name from ndb_show_tables_results where id = @t1_id and name like '%t1%' and type like '%UserTable%';
240 name
241 't1'
242 ALTER TABLE t1 ADD c CHAR(19) COLUMN_FORMAT FIXED;
243 INSERT INTO t1 values (2,1,"a");
244 SELECT * FROM t1 ORDER BY a;
245 a b c
246 1 1 NULL
247 2 1 a
248 UPDATE t1 SET c = 'b' WHERE a = 2;
249 SELECT * FROM t1 ORDER BY a;
250 a b c
251 1 1 NULL
252 2 1 b
253 DROP TABLE t1;
254 *******************************
255 * Not supported Test#7
256 * Ndb doesn't support renaming attributes on-line
257 *******************************
258 CREATE TABLE t1 (
259 auto int(5) unsigned NOT NULL auto_increment,
260 string char(10),
261 vstring varchar(10),
262 bin binary(2),
263 vbin varbinary(7),
264 tiny tinyint(4) DEFAULT '0' NOT NULL ,
265 short smallint(6) DEFAULT '1' NOT NULL ,
266 medium mediumint(8) DEFAULT '0' NOT NULL,
267 long_int int(11) DEFAULT '0' NOT NULL,
268 longlong bigint(13) DEFAULT '0' NOT NULL,
269 real_float float(13,1) DEFAULT 0.0 NOT NULL,
270 real_double double(16,4),
271 real_decimal decimal(16,4),
272 utiny tinyint(3) unsigned DEFAULT '0' NOT NULL,
273 ushort smallint(5) unsigned zerofill DEFAULT '00000' NOT NULL,
274 umedium mediumint(8) unsigned DEFAULT '0' NOT NULL,
275 ulong int(11) unsigned DEFAULT '0' NOT NULL,
276 ulonglong bigint(13) unsigned DEFAULT '0' NOT NULL,
277 bits bit(3),
278 options enum('zero','one','two','three','four') not null,
279 flags set('zero','one','two','three','four') not null,
280 date_field date,
281 year_field year,
282 time_field time,
283 date_time datetime,
284 time_stamp timestamp,
285 PRIMARY KEY (auto)
286 ) engine=ndb;
287 Warnings:
288 Warning 1681 Integer display width is deprecated and will be removed in a future release.
289 Warning 1681 Integer display width is deprecated and will be removed in a future release.
290 Warning 1681 Integer display width is deprecated and will be removed in a future release.
291 Warning 1681 Integer display width is deprecated and will be removed in a future release.
292 Warning 1681 Integer display width is deprecated and will be removed in a future release.
293 Warning 1681 Integer display width is deprecated and will be removed in a future release.
294 Warning 1681 Specifying number of digits for floating point data types is deprecated and will be removed in a future release.
295 Warning 1681 Specifying number of digits for floating point data types is deprecated and will be removed in a future release.
296 Warning 1681 Integer display width is deprecated and will be removed in a future release.
297 Warning 1681 The ZEROFILL attribute is deprecated and will be removed in a future release. Use the LPAD function to zero-pad numbers, or store the formatted numbers in a CHAR column.
298 Warning 1681 Integer display width is deprecated and will be removed in a future release.
299 Warning 1681 Integer display width is deprecated and will be removed in a future release.
300 Warning 1681 Integer display width is deprecated and will be removed in a future release.
301 Warning 1681 Integer display width is deprecated and will be removed in a future release.
302 set @t1_id = (select id from ndb_show_tables_results where name like '%t1%' and type like '%UserTable%');
303 alter table t1 algorithm=inplace, change tiny new_tiny tinyint(4) DEFAULT '0';
304 ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Altering if field is nullable is not supported. Try ALGORITHM=COPY.
305 select name from ndb_show_tables_results where id = @t1_id and name like '%t1%' and type like '%UserTable%';
306 name
307 't1'
308 alter table t1 change tiny tiny2 tinyint(4) DEFAULT '0' NOT NULL;
309 Warnings:
310 Warning 1681 Integer display width is deprecated and will be removed in a future release.
311 alter table t1 algorithm=inplace, change tiny2 new_tiny tinyint(4) DEFAULT '0' NOT NULL;
312 Warnings:
313 Warning 1681 Integer display width is deprecated and will be removed in a future release.
314 alter table t1 algorithm=inplace, change new_tiny new_tiny tinyint(4) DEFAULT '1' NOT NULL;
315 ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Altering default value is not supported. Try ALGORITHM=COPY.
316 select name from ndb_show_tables_results where id = @t1_id and name like '%t1%' and type like '%UserTable%';
317 name
318 't1'
319 set @t1_id = (select id from ndb_show_tables_results where name like '%t1%' and type like '%UserTable%');
320 alter table t1 change new_tiny new_tiny tinyint(4) DEFAULT '1' NOT NULL;
321 Warnings:
322 Warning 1681 Integer display width is deprecated and will be removed in a future release.
323 create index i1 on t1(medium);
324 alter table t1 add index i2(new_tiny);
325 drop index i1 on t1;
326 select name from ndb_show_tables_results where id = @t1_id and name like '%t1%' and type like '%UserTable%';
327 name
328 DROP TABLE t1;
329 #
330 # Bug#34224193 Adding default value for not null column with
331 # ALTER TABLE have issues.
332 #
333 CREATE TABLE t1 (
334 pk int AUTO_INCREMENT PRIMARY KEY,
335 col1 int NOT NULL,
336 col2 int NOT NULL DEFAULT 0
337 ) ENGINE=ndbcluster;
338 ALTER TABLE t1 algorithm=inplace, CHANGE col1 col1 int NOT NULL DEFAULT 0;
339 ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Adding or removing default value is not supported. Try ALGORITHM=COPY.
340 ALTER TABLE t1 CHANGE col1 col1 int NOT NULL DEFAULT 0;
341 INSERT INTO t1() VALUE();
342 SHOW WARNINGS;
343 Level Code Message
344 ALTER TABLE t1 algorithm=inplace, CHANGE col1 col1 int NOT NULL;
345 ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Adding or removing default value is not supported. Try ALGORITHM=COPY.
346 DROP TABLE t1;
347 ****************************************
348 * Adding dropping primary key
349 ****************************************
350 CREATE TABLE t1 (a INT UNSIGNED NOT NULL) ENGINE NDB;
351 Primary keys:
352 Number of primary keys: 1
353 $PK Bigunsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY AUTO_INCR
354 PRIMARY KEY($PK) - UniqueHashIndex
355 ALTER TABLE t1 algorithm=inplace, ADD PRIMARY KEY (a);
356 ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Adding primary key. Try ALGORITHM=COPY.
357 ALTER TABLE t1 algorithm=copy, ADD PRIMARY KEY (a);
358 Primary keys:
359 Number of primary keys: 1
360 a Unsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
361 PRIMARY KEY(a) - UniqueHashIndex
362 PRIMARY(a) - OrderedIndex
363 ALTER TABLE t1 algorithm=inplace, DROP PRIMARY KEY;
364 ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Dropping primary key. Try ALGORITHM=COPY.
365 ALTER TABLE t1 algorithm=copy, DROP PRIMARY KEY;
366 Primary keys:
367 Number of primary keys: 1
368 $PK Bigunsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY AUTO_INCR
369 PRIMARY KEY($PK) - UniqueHashIndex
370 CREATE UNIQUE INDEX pk ON t1(a) algorithm=inplace;
371 ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Adding primary key. Try ALGORITHM=COPY.
372 CREATE UNIQUE INDEX pk ON t1(a) algorithm=copy;
373 Primary keys:
374 Number of primary keys: 1
375 a Unsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
376 PRIMARY KEY(a) - UniqueHashIndex
377 ALTER TABLE t1 algorithm=inplace, DROP INDEX PK;
378 ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Dropping primary key. Try ALGORITHM=COPY.
379 ALTER TABLE t1 algorithm=copy, DROP INDEX PK;
380 Primary keys:
381 Number of primary keys: 1
382 $PK Bigunsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY AUTO_INCR
383 PRIMARY KEY($PK) - UniqueHashIndex
384 DROP TABLE t1;
385 CREATE TABLE t1 (a INT UNSIGNED) ENGINE NDB;
386 ALTER TABLE t1 algorithm=inplace, ADD b INT UNIQUE;
387 ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Only add column exclusively can be performed online. Try ALGORITHM=COPY.
388 ALTER TABLE t1 algorithm=copy, ADD b INT UNIQUE;
389 Primary keys:
390 Number of primary keys: 1
391 $PK Bigunsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY AUTO_INCR
392 PRIMARY KEY($PK) - UniqueHashIndex
393 ALTER TABLE t1 algorithm=inplace, ADD c INT NOT NULL UNIQUE;
394 ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Adding primary key. Try ALGORITHM=COPY.
395 ALTER TABLE t1 algorithm=copy, ADD c INT NOT NULL UNIQUE;
396 Primary keys:
397 Number of primary keys: 1
398 c Int PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
399 PRIMARY KEY(c) - UniqueHashIndex
400 DROP TABLE t1;
401 ****************************************
402 * Add column c as nullable TEXT and BLOB
403 ****************************************
404 CREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT KEY, b INT DEFAULT 2 COLUMN_FORMAT DYNAMIC) ENGINE NDB;
405 set @t1_id = (select id from ndb_show_tables_results where name like '%t1%' and type like '%UserTable%');
406 ALTER TABLE t1 algorithm=inplace, ADD c TEXT;
407 ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Adding column(s) or add/reorganize partition not supported online. Try ALGORITHM=COPY.
408 select name from ndb_show_tables_results where id = @t1_id and name like '%t1%' and type like '%UserTable%';
409 name
410 't1'
411 ALTER TABLE t1 algorithm=inplace, ADD d BLOB;
412 ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Adding column(s) or add/reorganize partition not supported online. Try ALGORITHM=COPY.
413 select name from ndb_show_tables_results where id = @t1_id and name like '%t1%' and type like '%UserTable%';
414 name
415 't1'
416 DROP TABLE t1;
417 CREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT KEY, b INT COLUMN_FORMAT DYNAMIC) ENGINE NDB;
418 set @t1_id = (select id from ndb_show_tables_results where name like '%t1%' and type like '%UserTable%');
419 *******************************
420 * Add column c as nullable FLOAT
421 *******************************
422 ALTER TABLE t1 algorithm=inplace, ADD c FLOAT;
423 Warnings:
424 Warning 1478 Converted FIXED field 'c' to DYNAMIC to enable online ADD COLUMN
425 *******************************
426 * Add column d as nullable DOUBLE
427 *******************************
428 ALTER TABLE t1 algorithm=inplace, ADD d DOUBLE UNSIGNED;
429 Warnings:
430 Warning 1681 UNSIGNED for decimal and floating point data types is deprecated and support for it will be removed in a future release.
431 Warning 1478 Converted FIXED field 'd' to DYNAMIC to enable online ADD COLUMN
432 *******************************
433 * Add column e as nullable DECIMAL
434 *******************************
435 ALTER TABLE t1 algorithm=inplace, ADD e DECIMAL(5,2);
436 Warnings:
437 Warning 1478 Converted FIXED field 'e' to DYNAMIC to enable online ADD COLUMN
438 *******************************
439 * Add column f as nullable DATETIME
440 *******************************
441 ALTER TABLE t1 algorithm=inplace, ADD f DATETIME;
442 Warnings:
443 Warning 1478 Converted FIXED field 'f' to DYNAMIC to enable online ADD COLUMN
444 *******************************
445 * Add column g as nullable BINARY
446 *******************************
447 ALTER TABLE t1 ADD g BINARY(4);
448 Warnings:
449 Warning 1478 Converted FIXED field 'g' to DYNAMIC to enable online ADD COLUMN
450 select name from ndb_show_tables_results where id = @t1_id and name like '%t1%' and type like '%UserTable%';
451 name
452 't1'
453 SELECT COUNT(*) FROM t1 WHERE c IS NULL;
454 COUNT(*)
455 5
456 SELECT COUNT(*) FROM t1 WHERE d IS NULL;
457 COUNT(*)
458 10
459 SELECT COUNT(*) FROM t1 WHERE e IS NULL;
460 COUNT(*)
461 15
462 SELECT COUNT(*) FROM t1 WHERE f IS NULL;
463 COUNT(*)
464 20
465 SELECT COUNT(*) FROM t1 WHERE g IS NULL;
466 COUNT(*)
467 25
468 UPDATE t1 SET c = 3.402823466E+38, d = 1.2686868689898E+308, e = 666.66, f = '2007-10-23 23:23:23', g = '1111' WHERE a = 1;
469 SELECT * FROM t1 WHERE a = 1 or a = 10 or a = 20 or a = 30 ORDER BY a;
470 a b c d e f g
471 1 5 3.40282e38 1.2686868689898e308 666.66 2007-10-23 23:23:23 1111
472 10 1 -3.40282e38 NULL NULL NULL NULL
473 20 1 -3.40282e38 1.7976931348623e308 345.21 NULL NULL
474 30 1 -3.40282e38 1.7976931348623e308 345.21 1000-01-01 00:00:00 0101
475 *********************************
476 * Backup and restore tables w/ new column
477 *********************************
478 DROP TABLE t1;
479 ForceVarPart: 1
480 DROP TABLE t1;
481 *********************************
482 * Disk Data error testing
483 *********************************
484 set default_storage_engine=ndb;
485 CREATE LOGFILE GROUP lg1
486 ADD UNDOFILE 'undofile.dat'
487 INITIAL_SIZE 16M
488 UNDO_BUFFER_SIZE = 1M;
489 CREATE TABLESPACE ts1
490 ADD DATAFILE 'datafile.dat'
491 USE LOGFILE GROUP lg1
492 INITIAL_SIZE 12M
493 ENGINE NDB;
494 DISK stored column b will become fixed
495 CREATE TABLE t1
496 (pk1 INT NOT NULL PRIMARY KEY, b INT COLUMN_FORMAT DYNAMIC)
497 TABLESPACE ts1 STORAGE DISK
498 ENGINE=NDB;
499 Warnings:
500 Warning 1478 DYNAMIC column b with STORAGE DISK is not supported, column will become FIXED
501 ALTER TABLE t1 algorithm=inplace, CHANGE b b INT COLUMN_FORMAT FIXED STORAGE MEMORY;
502 ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Column storage media is changed. Try ALGORITHM=COPY.
503 ALTER TABLE t1 algorithm=inplace, CHANGE b b_1 INT COLUMN_FORMAT DYNAMIC;
504 ALTER TABLE t1 algorithm=inplace, CHANGE b_1 b_2 INT COLUMN_FORMAT DYNAMIC STORAGE DISK;
505 ALTER TABLE t1 algorithm=inplace, RENAME COLUMN b_2 TO b;
506 ALTER TABLE t1 algorithm=inplace, CHANGE b pk1 INT COLUMN_FORMAT DYNAMIC;
507 ERROR 42S21: Duplicate column name 'pk1'
508 ALTER TABLE t1 algorithm=inplace, CHANGE b b INT COLUMN_FORMAT DYNAMIC STORAGE DISK;
509 ALTER TABLE t1 algorithm=inplace, CHANGE b b INT COLUMN_FORMAT DYNAMIC;
510 ALTER TABLE t1 algorithm=inplace, CHANGE b b INT;
511 ALTER TABLE t1 algorithm=inplace, ADD COLUMN c INT COLUMN_FORMAT DYNAMIC;
512 ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Adding column(s) or add/reorganize partition not supported online. Try ALGORITHM=COPY.
513 ALTER TABLE t1 algorithm=inplace, ADD COLUMN d FLOAT COLUMN_FORMAT DYNAMIC;
514 ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Adding column(s) or add/reorganize partition not supported online. Try ALGORITHM=COPY.
515 ALTER TABLE t1 algorithm=inplace, ADD COLUMN e DOUBLE COLUMN_FORMAT DYNAMIC;
516 ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Adding column(s) or add/reorganize partition not supported online. Try ALGORITHM=COPY.
517 ALTER TABLE t1 algorithm=inplace, ADD COLUMN f DATETIME COLUMN_FORMAT DYNAMIC;
518 ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Adding column(s) or add/reorganize partition not supported online. Try ALGORITHM=COPY.
519 ALTER TABLE t1 algorithm=inplace, ADD COLUMN g DECIMAL(5,2) COLUMN_FORMAT DYNAMIC;
520 ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Adding column(s) or add/reorganize partition not supported online. Try ALGORITHM=COPY.
521 ALTER TABLE t1 algorithm=inplace, ADD COLUMN h CHAR(20) COLUMN_FORMAT DYNAMIC;
522 ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Adding column(s) or add/reorganize partition not supported online. Try ALGORITHM=COPY.
523 ALTER TABLE t1 algorithm=inplace, ADD COLUMN h VARCHAR(20) COLUMN_FORMAT DYNAMIC;
524 ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Adding column(s) or add/reorganize partition not supported online. Try ALGORITHM=COPY.
525 ALTER TABLE t1 algorithm=inplace, ADD COLUMN h BINARY(20) COLUMN_FORMAT DYNAMIC;
526 ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Adding column(s) or add/reorganize partition not supported online. Try ALGORITHM=COPY.
527 ALTER TABLE t1 algorithm=inplace, ADD COLUMN h VARBINARY(20) COLUMN_FORMAT DYNAMIC;
528 ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Adding column(s) or add/reorganize partition not supported online. Try ALGORITHM=COPY.
529 DROP TABLE t1;
530 create table t1 (a int primary key, b int) storage disk tablespace ts1 engine = ndb;
531 alter table t1 algorithm=inplace, add column c0 int null column_format DYNAMIC;
532 ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Adding column(s) or add/reorganize partition not supported online. Try ALGORITHM=COPY.
533 alter table t1 algorithm=inplace, add column c1 int null column_format DYNAMIC storage memory;
534 drop table t1;
535 create table t1 (a int primary key, b int storage disk) tablespace ts1 engine = ndb;
536 alter table t1 algorithm=inplace, add column c0 int null column_format DYNAMIC;
537 alter table t1 algorithm=inplace, add column c1 int null column_format DYNAMIC storage memory;
538 drop table t1;
539 ALTER TABLESPACE ts1
540 DROP DATAFILE 'datafile.dat';
541 DROP TABLESPACE ts1;
542 DROP LOGFILE GROUP lg1
543 ENGINE =NDB;
544 ********************
545 * ROW_FORMAT testing
546 ********************
547 CREATE TABLE t1
548 (pk1 INT NOT NULL PRIMARY KEY, b INT COLUMN_FORMAT DYNAMIC)ROW_FORMAT=FIXED
549 ENGINE=NDB;
550 Warnings:
551 Warning 1478 Row format FIXED incompatible with dynamic attribute b
552 Attributes:
553 pk1 Int PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
554 b Int NULL AT=FIXED ST=MEMORY DYNAMIC
555 DROP TABLE t1;
556 CREATE TABLE t1
557 (pk1 INT NOT NULL COLUMN_FORMAT FIXED PRIMARY KEY,
558 b INT COLUMN_FORMAT FIXED)ROW_FORMAT=DYNAMIC ENGINE=NDB;
559 Attributes:
560 pk1 Int PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
561 b Int NULL AT=FIXED ST=MEMORY
562 DROP TABLE t1;
563 ********************
564 * bug#44695 ALTER TABLE during START BACKUP crashes mysqld
565 ********************
566 CREATE TABLE t1(k INT NOT NULL PRIMARY KEY AUTO_INCREMENT) ROW_FORMAT=DYNAMIC ENGINE=NDB;
567 INSERT INTO t1 VALUES (NULL);
568 INSERT INTO t1 SELECT NULL FROM t1;
569 INSERT INTO t1 SELECT NULL FROM t1;
570 INSERT INTO t1 SELECT NULL FROM t1;
571 INSERT INTO t1 SELECT NULL FROM t1;
572 INSERT INTO t1 SELECT NULL FROM t1;
573 INSERT INTO t1 SELECT NULL FROM t1;
574 INSERT INTO t1 SELECT NULL FROM t1;
575 INSERT INTO t1 SELECT NULL FROM t1;
576 INSERT INTO t1 SELECT NULL FROM t1;
577 INSERT INTO t1 SELECT NULL FROM t1;
578 INSERT INTO t1 SELECT NULL FROM t1;
579 INSERT INTO t1 SELECT NULL FROM t1;
580 INSERT INTO t1 SELECT NULL FROM t1;
581 INSERT INTO t1 SELECT NULL FROM t1;
582 SELECT COUNT(*) FROM t1;
583 COUNT(*)
584 16384
585 ALTER TABLE t1 algorithm=inplace, ADD b INT;
586 DROP TABLE t1;
587 create table t1 ( c499 int, c498 int, c497 int, c496 int, c495 int, c494 int, c493 int, c492 int, c491 int, c490 int, c489 int, c488 int, c487 int, c486 int, c485 int, c484 int, c483 int, c482 int, c481 int, c480 int, c479 int, c478 int, c477 int, c476 int, c475 int, c474 int, c473 int, c472 int, c471 int, c470 int, c469 int, c468 int, c467 int, c466 int, c465 int, c464 int, c463 int, c462 int, c461 int, c460 int, c459 int, c458 int, c457 int, c456 int, c455 int, c454 int, c453 int, c452 int, c451 int, c450 int, c449 int, c448 int, c447 int, c446 int, c445 int, c444 int, c443 int, c442 int, c441 int, c440 int, c439 int, c438 int, c437 int, c436 int, c435 int, c434 int, c433 int, c432 int, c431 int, c430 int, c429 int, c428 int, c427 int, c426 int, c425 int, c424 int, c423 int, c422 int, c421 int, c420 int, c419 int, c418 int, c417 int, c416 int, c415 int, c414 int, c413 int, c412 int, c411 int, c410 int, c409 int, c408 int, c407 int, c406 int, c405 int, c404 int, c403 int, c402 int, c401 int, c400 int, c399 int, c398 int, c397 int, c396 int, c395 int, c394 int, c393 int, c392 int, c391 int, c390 int, c389 int, c388 int, c387 int, c386 int, c385 int, c384 int, c383 int, c382 int, c381 int, c380 int, c379 int, c378 int, c377 int, c376 int, c375 int, c374 int, c373 int, c372 int, c371 int, c370 int, c369 int, c368 int, c367 int, c366 int, c365 int, c364 int, c363 int, c362 int, c361 int, c360 int, c359 int, c358 int, c357 int, c356 int, c355 int, c354 int, c353 int, c352 int, c351 int, c350 int, c349 int, c348 int, c347 int, c346 int, c345 int, c344 int, c343 int, c342 int, c341 int, c340 int, c339 int, c338 int, c337 int, c336 int, c335 int, c334 int, c333 int, c332 int, c331 int, c330 int, c329 int, c328 int, c327 int, c326 int, c325 int, c324 int, c323 int, c322 int, c321 int, c320 int, c319 int, c318 int, c317 int, c316 int, c315 int, c314 int, c313 int, c312 int, c311 int, c310 int, c309 int, c308 int, c307 int, c306 int, c305 int, c304 int, c303 int, c302 int, c301 int, c300 int, c299 int, c298 int, c297 int, c296 int, c295 int, c294 int, c293 int, c292 int, c291 int, c290 int, c289 int, c288 int, c287 int, c286 int, c285 int, c284 int, c283 int, c282 int, c281 int, c280 int, c279 int, c278 int, c277 int, c276 int, c275 int, c274 int, c273 int, c272 int, c271 int, c270 int, c269 int, c268 int, c267 int, c266 int, c265 int, c264 int, c263 int, c262 int, c261 int, c260 int, c259 int, c258 int, c257 int, c256 int, c255 int, c254 int, c253 int, c252 int, c251 int, c250 int, c249 int, c248 int, c247 int, c246 int, c245 int, c244 int, c243 int, c242 int, c241 int, c240 int, c239 int, c238 int, c237 int, c236 int, c235 int, c234 int, c233 int, c232 int, c231 int, c230 int, c229 int, c228 int, c227 int, c226 int, c225 int, c224 int, c223 int, c222 int, c221 int, c220 int, c219 int, c218 int, c217 int, c216 int, c215 int, c214 int, c213 int, c212 int, c211 int, c210 int, c209 int, c208 int, c207 int, c206 int, c205 int, c204 int, c203 int, c202 int, c201 int, c200 int, c199 int, c198 int, c197 int, c196 int, c195 int, c194 int, c193 int, c192 int, c191 int, c190 int, c189 int, c188 int, c187 int, c186 int, c185 int, c184 int, c183 int, c182 int, c181 int, c180 int, c179 int, c178 int, c177 int, c176 int, c175 int, c174 int, c173 int, c172 int, c171 int, c170 int, c169 int, c168 int, c167 int, c166 int, c165 int, c164 int, c163 int, c162 int, c161 int, c160 int, c159 int, c158 int, c157 int, c156 int, c155 int, c154 int, c153 int, c152 int, c151 int, c150 int, c149 int, c148 int, c147 int, c146 int, c145 int, c144 int, c143 int, c142 int, c141 int, c140 int, c139 int, c138 int, c137 int, c136 int, c135 int, c134 int, c133 int, c132 int, c131 int, c130 int, c129 int, c128 int, c127 int, c126 int, c125 int, c124 int, c123 int, c122 int, c121 int, c120 int, c119 int, c118 int, c117 int, c116 int, c115 int, c114 int, c113 int, c112 int, c111 int, c110 int, c109 int, c108 int, c107 int, c106 int, c105 int, c104 int, c103 int, c102 int, c101 int, c100 int, c99 int, c98 int, c97 int, c96 int, c95 int, c94 int, c93 int, c92 int, c91 int, c90 int, c89 int, c88 int, c87 int, c86 int, c85 int, c84 int, c83 int, c82 int, c81 int, c80 int, c79 int, c78 int, c77 int, c76 int, c75 int, c74 int, c73 int, c72 int, c71 int, c70 int, c69 int, c68 int, c67 int, c66 int, c65 int, c64 int, c63 int, c62 int, c61 int, c60 int, c59 int, c58 int, c57 int, c56 int, c55 int, c54 int, c53 int, c52 int, c51 int, c50 int, c49 int, c48 int, c47 int, c46 int, c45 int, c44 int, c43 int, c42 int, c41 int, c40 int, c39 int, c38 int, c37 int, c36 int, c35 int, c34 int, c33 int, c32 int, c31 int, c30 int, c29 int, c28 int, c27 int, c26 int, c25 int, c24 int, c23 int, c22 int, c21 int, c20 int, c19 int, c18 int, c17 int, c16 int, c15 int, c14 int, c13 int, c12 int, c11 int, c10 int, c9 int, c8 int, c7 int, c6 int, c5 int, c4 int, c3 int, c2 int, c1 int, c501 varchar(10000) character set latin1, primary key using hash(c1)) engine=ndb;
588 insert into t1 (c1) values (1), (2), (3);
589 alter table t1 algorithm=copy, modify c1 int auto_increment;
590 alter table t1 algorithm=inplace, add column c500 bit(1) column_format DYNAMIC;
591 alter table t1 algorithm=copy, add column c502 varchar(18001) character set latin1;
592 ERROR HY000: Can't create destination table for copying alter table (use SHOW WARNINGS for more info).
593 show warnings;
594 Level Code Message
595 Warning 1296 Got error 738 'Record too big' from NDB
596 Error 1005 Can't create destination table for copying alter table (use SHOW WARNINGS for more info).
597 alter table t1 algorithm=inplace, add column c502 varchar(18001) character set latin1;
598 ERROR HY000: Got error 140 'Record too big' from NDBCLUSTER
599 show warnings;
600 Level Code Message
601 Warning 1478 Converted FIXED field 'c502' to DYNAMIC to enable online ADD COLUMN
602 Warning 1296 Got error 738 'Record too big' from NDB
603 Error 1296 Got error 140 'Record too big' from NDBCLUSTER
604 delete from t1;
605 drop table t1;
606 create table t1(a int(10) unsigned not null auto_increment,
607 b varchar(20) default 'x',
608 c varchar(20) default null,
609 primary key (a) ) engine=ndbcluster;
610 Warnings:
611 Warning 1681 Integer display width is deprecated and will be removed in a future release.
612 alter table t1 algorithm=inplace, add e varchar(20) default 'x' column_format dynamic;
613 ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Adding column with non-null default value is not supported online. Try ALGORITHM=COPY.
614 alter table t1 algorithm=inplace, add e varchar(20) default null column_format dynamic;
615 drop table t1;
616 CREATE TABLE categorylinks (
617 cl_from int(10) unsigned NOT NULL DEFAULT '0',
618 cl_to varbinary(255) NOT NULL DEFAULT '',
619 cl_sortkey varbinary(70) NOT NULL DEFAULT '',
620 cl_timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE
621 CURRENT_TIMESTAMP,
622 UNIQUE KEY cl_from (cl_from,cl_to),
623 KEY cl_sortkey (cl_to,cl_sortkey,cl_from),
624 KEY cl_timestamp (cl_to,cl_timestamp)
625 ) ENGINE=ndb DEFAULT CHARSET=binary;
626 Warnings:
627 Warning 1681 Integer display width is deprecated and will be removed in a future release.
628 ALTER TABLE categorylinks
629 CHANGE COLUMN cl_sortkey cl_sortkey varbinary(230) NOT NULL default
630 '',
631 ADD COLUMN cl_sortkey_prefix varchar(255) binary NOT NULL default '',
632 ADD COLUMN cl_collation varbinary(32) NOT NULL default '',
633 ADD COLUMN cl_type ENUM('page', 'subcat', 'file') NOT NULL default
634 'page',
635 ADD INDEX (cl_collation),
636 DROP INDEX cl_sortkey,
637 ADD INDEX cl_sortkey (cl_to, cl_type, cl_sortkey, cl_from);
638 Warnings:
639 Warning 1287 'BINARY as attribute of a type' is deprecated and will be removed in a future release. Please use a CHARACTER SET clause with _bin collation instead
640 SHOW CREATE TABLE categorylinks;
641 Table Create Table
642 categorylinks CREATE TABLE `categorylinks` (
643 `cl_from` int unsigned NOT NULL DEFAULT '0',
644 `cl_to` varbinary(255) NOT NULL DEFAULT '',
645 `cl_sortkey` varbinary(230) NOT NULL DEFAULT '',
646 `cl_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
647 `cl_sortkey_prefix` varbinary(255) NOT NULL DEFAULT '',
648 `cl_collation` varbinary(32) NOT NULL DEFAULT '',
649 `cl_type` enum('page','subcat','file') NOT NULL DEFAULT 'page',
650 UNIQUE KEY `cl_from` (`cl_from`,`cl_to`),
651 KEY `cl_timestamp` (`cl_to`,`cl_timestamp`),
652 KEY `cl_collation` (`cl_collation`),
653 KEY `cl_sortkey` (`cl_to`,`cl_type`,`cl_sortkey`,`cl_from`)
654 ) ENGINE=ndbcluster DEFAULT CHARSET=binary
655 DROP TABLE categorylinks;