1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635
|
--echo #
--echo # WL#13341: Store options for secondary engines.
--echo # Testing engine and secondary engine attributes on tables, fields and
--echo # indices.
--echo #
--echo ### Testing ENGINE_ATTRIBUTE on table
--error ER_PARSE_ERROR
CREATE TABLE t1(i INT) ENGINE_ATTRIBUTE;
--error ER_INVALID_JSON_ATTRIBUTE
CREATE TABLE t1(i INT) engine_ATTRIBUTE='{bad:json';
--echo # Testing attributes on tables
if (!$SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED
}
CREATE TABLE t1(i INT) ENGINE_ATTRIBUTE='';
if ($SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM information_schema.tables_extensions WHERE table_name = 't1';
DROP TABLE t1;
}
if (!$SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED
}
CREATE TABLE t1(i INT) ENGINE_ATTRIBUTE='{"table attr": "for engine"}';
if ($SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM information_schema.tables_extensions WHERE table_name = 't1';
DROP TABLE t1;
}
--echo ### Testing SECONDARY_ENGINE_ATTRIBUTE on table
--error ER_PARSE_ERROR
CREATE TABLE t1(i INT) SECONDARY_ENGINE_ATTRIBUTE;
--error ER_INVALID_JSON_ATTRIBUTE
CREATE TABLE t1(i INT) SECONDARY_engine_ATTRIBUTE='{bad:json';
CREATE TABLE t1(i INT) SECONDARY_ENGINE_ATTRIBUTE='';
SHOW CREATE TABLE t1;
DROP TABLE t1;
CREATE TABLE t1(i INT) SECONDARY_ENGINE_ATTRIBUTE='{"table attr": "for secondary engine"}';
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM information_schema.tables_extensions WHERE table_name = 't1';
DROP TABLE t1;
--echo ### Testing ENGINE_ATTRIBUTE on column
--error ER_PARSE_ERROR
CREATE TABLE t1(i INT ENGINE_ATTRIBUTE);
if (!$SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED
}
CREATE TABLE t1(i INT ENGINE_ATTRIBUTE='');
if ($SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
SHOW CREATE TABLE t1;
SHOW FULL COLUMNS FROM t1;
--sorted_result
SELECT * FROM information_schema.columns_extensions WHERE table_name = 't1';
DROP TABLE t1;
}
if (!$SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED
}
CREATE TABLE t1(i INT ENGINE_ATTRIBUTE='{"column attr": "for engine"}' SECONDARY_ENGINE_ATTRIBUTE='{"column attr": "for secondary engine"}');
if ($SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
SHOW CREATE TABLE t1;
SHOW FULL COLUMNS FROM t1;
--sorted_result
SELECT * FROM information_schema.columns_extensions WHERE table_name = 't1';
DROP TABLE t1;
}
--echo ### Testing ENGINE_ATTRIBUTE on index specified as a part of CREATE
--error ER_PARSE_ERROR
CREATE TABLE t1(i INT, j INT, INDEX(j) ENGINE_ATTRIBUTE);
--error ER_INVALID_JSON_ATTRIBUTE
CREATE TABLE t1(i INT, j INT, INDEX(j) ENGINE_ATTRIBUTE='{"index attr": }');
if (!$SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED
}
CREATE TABLE t1(i INT, j INT, INDEX(j) ENGINE_ATTRIBUTE='{"index attr": "for engine"}' SECONDARY_ENGINE_ATTRIBUTE='{"index attr": "for secondary engine"}');
if ($SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
SHOW CREATE TABLE t1;
SHOW INDEX FROM t1;
--sorted_result
SELECT * FROM information_schema.table_constraints_extensions WHERE table_name = 't1';
DROP TABLE t1;
}
--echo ### Testing ENGINE_ATTRIBUTE with CREATE INDEX
CREATE TABLE t1(i INT, j INT);
--error ER_PARSE_ERROR
CREATE INDEX ix ON t1(i) ENGINE_ATTRIBUTE;
--error ER_INVALID_JSON_ATTRIBUTE
CREATE INDEX ix ON t1(i) ENGINE_ATTRIBUTE='{attr';
if (!$SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED
}
CREATE INDEX ix ON t1(i) ENGINE_ATTRIBUTE='{"index attr": "for engine"}' SECONDARY_ENGINE_ATTRIBUTE='{"index attr":"for secondary engine"}';
SHOW CREATE TABLE t1;
SHOW INDEX FROM t1;
--sorted_result
SELECT * FROM information_schema.table_constraints_extensions WHERE table_name = 't1';
DROP TABLE t1;
--echo ### Creating table with all possible engine attributes.
if (!$SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED
}
CREATE TABLE t1(i INT
ENGINE_ATTRIBUTE = '{"column attr": "i"}'
SECONDARY_ENGINE_ATTRIBUTE='{"secondary column attr": "i"}',
j INT ENGINE_ATTRIBUTE = '{"column attr": "j"}'
SECONDARY_ENGINE_ATTRIBUTE='{"secondary column attr": "j"}',
INDEX(j) ENGINE_ATTRIBUTE='{"index attr": "index on j"}'
SECONDARY_ENGINE_ATTRIBUTE='{"secondary index attr": "index on j"}')
ENGINE_ATTRIBUTE = '{"table attr":"t1"}' SECONDARY_ENGINE_ATTRIBUTE = '{"secondary table attr": "t1"}';
if ($SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
SHOW CREATE TABLE t1;
SHOW FULL COLUMNS FROM t1;
SHOW INDEX FROM t1;
--sorted_result
SELECT * FROM information_schema.tables_extensions WHERE table_name = 't1';
--sorted_result
SELECT * FROM information_schema.columns_extensions WHERE table_name = 't1' ORDER BY column_name;
--sorted_result
SELECT * FROM information_schema.table_constraints_extensions WHERE table_name = 't1' ORDER BY constraint_name;
--echo # Verify that SHOW CREATE TABLE output can be used to create
--echo # an identical table
--let $SCT1= query_get_value(SHOW CREATE TABLE t1, Create Table, 1)
DROP TABLE t1;
--eval $SCT1
--let $SCT1_= query_get_value(SHOW CREATE TABLE t1, Create Table, 1)
--echo # There should be no output beween here
if ($SCT1 != $SCT1_)
{
--echo SHOW CREATE TABLE output not stable
--echo $SCT1
--echo vs
--echo $SCT1_
}
--echo # ... and here
DROP TABLE t1;
}
--echo ## Verify engine attributes are duplicated in the same way as comment
--echo ## in CREATE LIKE/CREATE AS SELECT
if (!$SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED
}
CREATE TABLE t1(i INT
ENGINE_ATTRIBUTE = '{"column attr": "i"}'
SECONDARY_ENGINE_ATTRIBUTE='{"secondary column attr": "i"}'
COMMENT 'Column comment',
j INT ENGINE_ATTRIBUTE = '{"column attr": "j"}'
SECONDARY_ENGINE_ATTRIBUTE='{"secondary column attr": "j"}',
INDEX(j) ENGINE_ATTRIBUTE='{"index attr": "index on j"}'
SECONDARY_ENGINE_ATTRIBUTE='{"secondary index attr": "index on j"}' COMMENT 'index comment')
ENGINE_ATTRIBUTE = '{"table attr":"t1"}' SECONDARY_ENGINE_ATTRIBUTE = '{"secondary table attr": "t1"}' COMMENT='Table comment';
if ($SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
SHOW CREATE TABLE t1;
SHOW FULL COLUMNS FROM t1;
SHOW INDEX FROM t1;
--sorted_result
SELECT * FROM information_schema.tables_extensions WHERE table_name = 't1';
--sorted_result
SELECT * FROM information_schema.columns_extensions WHERE table_name = 't1' ORDER BY column_name;
--sorted_result
SELECT * FROM information_schema.table_constraints_extensions WHERE table_name = 't1' ORDER BY constraint_name;
CREATE TABLE t2 LIKE t1;
--echo # Expect all engine attributes from t1 to be present also in t2
SHOW CREATE TABLE t2;
SHOW FULL COLUMNS FROM t2;
SHOW INDEX FROM t2;
CREATE TABLE t3 ENGINE_ATTRIBUTE='{"table attr": "t3, create as select"}' AS SELECT * FROM t1;
--echo # Expect column engine attributes from t1 to be present in t3.
--echo # Indices are not duplicated so index engine attributes will not be
--echo # present.
--echo # Table engine attributes are not duplicated, just like table comments.
SHOW CREATE TABLE t3;
SHOW FULL COLUMNS FROM t3;
SHOW INDEX FROM t3;
--sorted_result
SELECT * FROM information_schema.tables_extensions WHERE table_name = 't3';
--sorted_result
SELECT * FROM information_schema.columns_extensions WHERE table_name = 't3' ORDER BY column_name;
--sorted_result
SELECT * FROM information_schema.table_constraints_extensions WHERE table_name = 't3' ORDER BY constraint_name;
DROP TABLE t3;
DROP TABLE t2;
DROP TABLE t1;
}
--echo ## Verfy expected behavior for repeated engine attributes
if (!$SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED
}
CREATE TABLE t1(i INT
ENGINE_ATTRIBUTE = '{"column attr": "i"}'
ENGINE_ATTRIBUTE = '{"column attr": "override"}'
SECONDARY_ENGINE_ATTRIBUTE='{"secondary column attr": "i"}'
SECONDARY_ENGINE_ATTRIBUTE='{"secondary column attr": "override"}'
COMMENT 'Column comment'
COMMENT 'Column comment override',
j INT ENGINE_ATTRIBUTE = '{"column attr": "j"}'
ENGINE_ATTRIBUTE = '{"column attr": "override"}'
SECONDARY_ENGINE_ATTRIBUTE='{"secondary column attr": "j"}'
SECONDARY_ENGINE_ATTRIBUTE='{"secondary column attr": "override"}',
INDEX(j) ENGINE_ATTRIBUTE='{"index attr": "index on j"}' ENGINE_ATTRIBUTE='{"index attr": "index on j override"}'
SECONDARY_ENGINE_ATTRIBUTE='{"secondary index attr": "index on j"}'
SECONDARY_ENGINE_ATTRIBUTE='{"secondary index attr": "index on j override"}'
COMMENT 'index comment'
COMMENT 'index comment override'
)
ENGINE_ATTRIBUTE = '{"table attr":"t1"}'
ENGINE_ATTRIBUTE = '{"table attr":"t1 override"}'
SECONDARY_ENGINE_ATTRIBUTE = '{"secondary table attr": "t1"}'
SECONDARY_ENGINE_ATTRIBUTE = '{"secondary table attr": "t1 override"}'
COMMENT='Table comment'
COMMENT='Table comment override';
if ($SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
SHOW CREATE TABLE t1;
SHOW FULL COLUMNS FROM t1;
SHOW INDEX FROM t1;
--sorted_result
SELECT * FROM information_schema.tables_extensions WHERE table_name = 't1';
--sorted_result
SELECT * FROM information_schema.columns_extensions WHERE table_name = 't1' ORDER BY column_name;
--sorted_result
SELECT * FROM information_schema.table_constraints_extensions WHERE table_name = 't1' ORDER BY constraint_name;
DROP TABLE t1;
}
--echo #
--echo # Testing altering engine attribute on tables,
--echo # columns and indices.
--echo #
CREATE TABLE t1(i INT, j INT, k INT);
--echo ## Altering attributes on table
if (!$SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED
}
ALTER TABLE t1 ENGINE_ATTRIBUTE='{"table algo": "none"}';
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM information_schema.tables_extensions WHERE table_name = 't1';
if (!$SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED
}
ALTER TABLE t1 ENGINE_ATTRIBUTE='{"table algo": "inplace"}',
ALGORITHM=INPLACE;
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM information_schema.tables_extensions WHERE table_name = 't1';
if (!$SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED
ALTER TABLE t1 ENGINE_ATTRIBUTE='{"table algo": "instant"}',
ALGORITHM=INSTANT;
}
if ($SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 ENGINE_ATTRIBUTE='{"table algo": "instant"}',
ALGORITHM=INSTANT;
}
--echo ## Adding columns with attributes
if (!$SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED
}
ALTER TABLE t1 ADD COLUMN l VARCHAR(64) ENGINE_ATTRIBUTE='{"add column algo":"none"}';
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM information_schema.columns_extensions WHERE table_name = 't1';
if (!$SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED
}
ALTER TABLE t1 ADD COLUMN m VARCHAR(64) ENGINE_ATTRIBUTE='{"add column algo":"inplace"}', ALGORITHM=INPLACE;
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM information_schema.columns_extensions WHERE table_name = 't1';
if (!$SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED
}
ALTER TABLE t1 ADD COLUMN n VARCHAR(64) ENGINE_ATTRIBUTE='{"add column algo":"instant"}', ALGORITHM=INSTANT;
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM information_schema.columns_extensions WHERE table_name = 't1';
--echo ## Modifying columns with attributes
if (!$SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED
}
ALTER TABLE t1 MODIFY COLUMN l INT ENGINE_ATTRIBUTE='{"modify column algo": "none"}';
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM information_schema.columns_extensions WHERE table_name = 't1';
if (!$SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED
ALTER TABLE t1 MODIFY COLUMN m INT ENGINE_ATTRIBUTE='{"modify column algo": "inplace"}', ALGORITHM=INPLACE;
}
if ($SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 MODIFY COLUMN m INT ENGINE_ATTRIBUTE='{"modify column algo": "inplace"}', ALGORITHM=INPLACE;
}
if (!$SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED
ALTER TABLE t1 MODIFY COLUMN n INT ENGINE_ATTRIBUTE='{"modify column algo": "instant"}', ALGORITHM=INSTANT;
}
if ($SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 MODIFY COLUMN n INT ENGINE_ATTRIBUTE='{"modify column algo": "instant"}', ALGORITHM=INSTANT;
}
--echo ## Changing columns with attributes
if (!$SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED
ALTER TABLE t1 CHANGE COLUMN l ll CHAR(8) ENGINE_ATTRIBUTE='{"change column algo": "none"}';
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM information_schema.columns_extensions WHERE table_name = 't1';
}
if (!$SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED
ALTER TABLE t1 CHANGE COLUMN m mm CHAR(8) ENGINE_ATTRIBUTE='{"change column algo": "inplace" }', ALGORITHM=INPLACE;
}
if ($SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 CHANGE COLUMN m mm CHAR(8) ENGINE_ATTRIBUTE='{"change column algo": "inplace" }', ALGORITHM=INPLACE;
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM information_schema.columns_extensions WHERE table_name = 't1';
}
if (!$SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED
ALTER TABLE t1 CHANGE COLUMN n nn CHAR(8) ENGINE_ATTRIBUTE='{"change column algo": "instant" }', ALGORITHM=INSTANT;
}
if ($SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 CHANGE COLUMN n nn CHAR(8) ENGINE_ATTRIBUTE='{"change column algo": "instant" }', ALGORITHM=INSTANT;
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM information_schema.columns_extensions WHERE table_name = 't1';
}
--echo ## Adding index with attributes
if (!$SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED
}
ALTER TABLE t1 ADD INDEX (i) ENGINE_ATTRIBUTE='{"index algo":"none"}';
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM information_schema.table_constraints_extensions WHERE table_name = 't1';
if (!$SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED
ALTER TABLE t1 ADD INDEX (m) ENGINE_ATTRIBUTE='{"index algo":"inplace"}', ALGORITHM=INPLACE;
}
if ($SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
ALTER TABLE t1 ADD INDEX (m) ENGINE_ATTRIBUTE='{"index algo":"inplace"}', ALGORITHM=INPLACE;
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM information_schema.table_constraints_extensions WHERE table_name = 't1';
}
if (!$SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED
ALTER TABLE t1 ADD INDEX (n) ENGINE_ATTRIBUTE='{"index algo":"instant"}', ALGORITHM=INSTANT;
}
if ($SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 ADD INDEX (n) ENGINE_ATTRIBUTE='{"index algo":"instant"}', ALGORITHM=INSTANT;
}
DROP TABLE t1;
--echo #
--echo # Testing altering secondary engine attribute on tables and
--echo # columns, and indices.
--echo #
CREATE TABLE t1(i INT, j INT, k INT);
--echo ## Altering attributes on table
ALTER TABLE t1 SECONDARY_ENGINE_ATTRIBUTE='{"table algo": "none"}';
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM information_schema.tables_extensions WHERE table_name = 't1';
ALTER TABLE t1 SECONDARY_ENGINE_ATTRIBUTE='{"table algo": "inplace"}',
ALGORITHM=INPLACE;
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM information_schema.tables_extensions WHERE table_name = 't1';
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 SECONDARY_ENGINE_ATTRIBUTE='{"table algo": "instant"}',
ALGORITHM=INSTANT;
--echo ## Adding columns with attributes
ALTER TABLE t1 ADD COLUMN l VARCHAR(64) SECONDARY_ENGINE_ATTRIBUTE='{"add column algo":"none"}';
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM information_schema.columns_extensions WHERE table_name = 't1';
ALTER TABLE t1 ADD COLUMN m VARCHAR(64) SECONDARY_ENGINE_ATTRIBUTE='{"add column algo":"inplace"}', ALGORITHM=INPLACE;
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM information_schema.columns_extensions WHERE table_name = 't1';
ALTER TABLE t1 ADD COLUMN n VARCHAR(64) SECONDARY_ENGINE_ATTRIBUTE='{"add column algo":"instant"}', ALGORITHM=INSTANT;
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM information_schema.columns_extensions WHERE table_name = 't1';
--echo ## Modifying columns with attributes
ALTER TABLE t1 MODIFY COLUMN l INT SECONDARY_ENGINE_ATTRIBUTE='{"modify column algo": "none"}';
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM information_schema.columns_extensions WHERE table_name = 't1';
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 MODIFY COLUMN m INT SECONDARY_ENGINE_ATTRIBUTE='{"modify column algo": "inplace"}', ALGORITHM=INPLACE;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 MODIFY COLUMN m INT SECONDARY_ENGINE_ATTRIBUTE='{"modify column algo": "inplace"}', ALGORITHM=INPLACE;
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM information_schema.columns_extensions WHERE table_name = 't1';
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 MODIFY COLUMN n INT SECONDARY_ENGINE_ATTRIBUTE='{"modify column algo": "instant"}', ALGORITHM=INSTANT;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 MODIFY COLUMN n INT SECONDARY_ENGINE_ATTRIBUTE='{"modify column algo": "instant"}', ALGORITHM=INSTANT;
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM information_schema.columns_extensions WHERE table_name = 't1';
--echo ## Changing columns with attributes
ALTER TABLE t1 CHANGE COLUMN l ll CHAR(8) SECONDARY_ENGINE_ATTRIBUTE='{"change column algo": "none"}';
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM information_schema.columns_extensions WHERE table_name = 't1';
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 CHANGE COLUMN m mm CHAR(8) SECONDARY_ENGINE_ATTRIBUTE='{"change column algo": "inplace" }', ALGORITHM=INPLACE;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 CHANGE COLUMN m mm CHAR(8) SECONDARY_ENGINE_ATTRIBUTE='{"change column algo": "inplace" }', ALGORITHM=INPLACE;
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM information_schema.columns_extensions WHERE table_name = 't1';
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 CHANGE COLUMN n nn CHAR(8) SECONDARY_ENGINE_ATTRIBUTE='{"change column algo": "instant" }', ALGORITHM=INSTANT;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 CHANGE COLUMN n nn CHAR(8) SECONDARY_ENGINE_ATTRIBUTE='{"change column algo": "instant" }', ALGORITHM=INSTANT;
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM information_schema.columns_extensions WHERE table_name = 't1';
--echo ## Adding index with attributes
ALTER TABLE t1 ADD INDEX (i) SECONDARY_ENGINE_ATTRIBUTE='{"index algo":"none"}';
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM information_schema.table_constraints_extensions WHERE table_name = 't1';
ALTER TABLE t1 ADD INDEX (m) SECONDARY_ENGINE_ATTRIBUTE='{"index algo":"inplace"}', ALGORITHM=INPLACE;
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM information_schema.table_constraints_extensions WHERE table_name = 't1';
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 ADD INDEX (n) SECONDARY_ENGINE_ATTRIBUTE='{"index algo":"instant"}', ALGORITHM=INSTANT;
DROP TABLE t1;
--echo # Testing all possible engine attribute clauses together
--echo #
CREATE TABLE t1(i INT, j INT, INDEX jix (j));
if (!$SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED
}
ALTER TABLE t1 MODIFY COLUMN i INT
ENGINE_ATTRIBUTE = '{"column attr": "i"}'
SECONDARY_ENGINE_ATTRIBUTE='{"secondary column attr": "i"}',
MODIFY COLUMN j INT ENGINE_ATTRIBUTE = '{"column attr": "j"}'
SECONDARY_ENGINE_ATTRIBUTE='{"secondary column attr": "j"}',
DROP INDEX jix,
ADD INDEX jix (i) ENGINE_ATTRIBUTE='{"index attr": "index on j"}'
SECONDARY_ENGINE_ATTRIBUTE='{"secondary index attr": "index on j"}',
ENGINE_ATTRIBUTE = '{"table attr":"t1"}'
SECONDARY_ENGINE_ATTRIBUTE = '{"secondary table attr": "t1"}';
if ($SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM information_schema.tables_extensions WHERE table_name = 't1';
--sorted_result
SELECT * FROM information_schema.columns_extensions WHERE table_name = 't1' ORDER BY column_name;
--sorted_result
SELECT * FROM information_schema.table_constraints_extensions WHERE table_name = 't1' ORDER BY constraint_name;
}
DROP TABLE t1;
--echo # Verfy that handler::check_if_supported_inplace_alter
--echo # (default if not overridden by SE) behaves the same way for
--echo # engine attributes as for comments.
CREATE TABLE t1(i INT, j INT, INDEX jix (j)) ENGINE=MYISAM;
ALTER TABLE t1 COMMENT 'A comment', ALGORITHM=INPLACE;
if (!$SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED
}
ALTER TABLE t1
SECONDARY_ENGINE_ATTRIBUTE='{"secondary column attr": "i"}',
MODIFY COLUMN j INT ENGINE_ATTRIBUTE = '{"column attr": "j"}'
SECONDARY_ENGINE_ATTRIBUTE='{"secondary column attr": "j"}',
DROP INDEX jix,
ADD INDEX jix (i) ENGINE_ATTRIBUTE='{"index attr": "index on j"}'
SECONDARY_ENGINE_ATTRIBUTE='{"secondary index attr": "index on j"}',
ENGINE_ATTRIBUTE = '{"table attr":"t1"}'
SECONDARY_ENGINE_ATTRIBUTE = '{"secondary table attr": "t1"}';
if ($SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM information_schema.tables_extensions WHERE table_name = 't1';
--sorted_result
SELECT * FROM information_schema.columns_extensions WHERE table_name = 't1' ORDER BY column_name;
--sorted_result
SELECT * FROM information_schema.table_constraints_extensions WHERE table_name = 't1' ORDER BY constraint_name;
}
DROP TABLE t1;
--echo # Verfy that handler::check_if_supported_inplace_alter
--echo # (default if not overridden by SE) behaves the same way for
--echo # engine attributes as for comments.
CREATE TABLE t1(i INT, j INT) ENGINE=MYISAM;
ALTER TABLE t1 COMMENT 'A comment', ALGORITHM=INSTANT;
if (!$SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED
}
ALTER TABLE t1 ENGINE_ATTRIBUTE='{"table algo": "inplace"}',
ALGORITHM=INSTANT;
ALTER TABLE t1 MODIFY COLUMN i INT COMMENT 'Modified column with comment', ALGORITHM=INSTANT;
if (!$SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED
}
ALTER TABLE t1 MODIFY COLUMN i INT ENGINE_ATTRIBUTE='{"modify column algo": "inplace"}', ALGORITHM=INSTANT;
ALTER TABLE t1 CHANGE COLUMN i mm INT COMMENT 'Changed column with comment', ALGORITHM=INSTANT;
if (!$SIMULATED_ENGINE_ATTRIBUTE_SUPPORT) {
--error ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED
}
ALTER TABLE t1 CHANGE COLUMN j nn INT ENGINE_ATTRIBUTE='{"change column algo": "inplace" }', ALGORITHM=INSTANT;
DROP TABLE t1;
--echo # Verfy that handler::check_if_supported_inplace_alter
--echo # (default if not overridden by SE) behaves the same way for
--echo # secondary engine attributes as for comments.
CREATE TABLE t1(i INT, j INT) ENGINE=MYISAM;
ALTER TABLE t1 COMMENT 'A comment', ALGORITHM=INSTANT;
ALTER TABLE t1 SECONDARY_ENGINE_ATTRIBUTE='{"table algo": "inplace"}',
ALGORITHM=INSTANT;
ALTER TABLE t1 MODIFY COLUMN i INT COMMENT 'Modified column with comment', ALGORITHM=INSTANT;
ALTER TABLE t1 MODIFY COLUMN i INT SECONDARY_ENGINE_ATTRIBUTE='{"modify column algo": "inplace"}', ALGORITHM=INSTANT;
ALTER TABLE t1 CHANGE COLUMN i mm INT COMMENT 'Changed column with comment', ALGORITHM=INSTANT;
ALTER TABLE t1 CHANGE COLUMN j nn INT SECONDARY_ENGINE_ATTRIBUTE='{"change column algo": "inplace" }', ALGORITHM=INSTANT;
DROP TABLE t1;
|