1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-07 06:01:31 +03:00

MDEV-16288 ALTER TABLE…ALGORITHM=DEFAULT does not override alter_algorithm

- ALTER_ALGORITHM should be substituted when there is no mention of
algorithm in alter statement.
- Introduced algorithm(thd) in Alter_info. It returns the
user requested algorithm. If user doesn't specify algorithm explicitly then
it returns alter_algorithm variable.
- changed algorithm() to get_algorithm(thd) to return algorithm name for
displaying the error.
- set_requested_algorithm(algo_value) to avoid direct assignment on
requested_algorithm variable.
- Avoid direct access of requested_algorithm to encapsulate
requested_algorithm variable
This commit is contained in:
Thirunarayanan Balathandayuthapani
2020-04-25 14:27:00 +05:30
parent f98017bb6d
commit ec9908b257
13 changed files with 143 additions and 50 deletions

View File

@ -54,3 +54,23 @@ DROP PROCEDURE p1;
affected rows: 0
DROP PROCEDURE p2;
affected rows: 0
CREATE TABLE t1(id INT PRIMARY KEY,
col1 INT UNSIGNED NOT NULL UNIQUE)ENGINE=InnoDB;
affected rows: 0
INSERT INTO t1 VALUES(1,1),(2,2),(3,3);
affected rows: 3
info: Records: 3 Duplicates: 0 Warnings: 0
SET ALTER_ALGORITHM=INSTANT;
affected rows: 0
ALTER TABLE t1 DROP COLUMN col1;
ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE
ALTER TABLE t1 DROP COLUMN col1, ALGORITHM=NOCOPY;
ERROR 0A000: ALGORITHM=NOCOPY is not supported for this operation. Try ALGORITHM=INPLACE
ALTER TABLE t1 DROP COLUMN col1, ALGORITHM=DEFAULT;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE t1 DROP PRIMARY KEY, ALGORITHM=DEFAULT;
affected rows: 3
info: Records: 3 Duplicates: 0 Warnings: 0
DROP TABLE t1;
affected rows: 0