mirror of
https://github.com/MariaDB/server.git
synced 2025-08-21 16:03:24 +03:00
ha_innobase::check_if_supported_inplace_alter(): For now, reject ALGORITHM=INPLACE when a non-constant DEFAULT expression is specified for ADD COLUMN or for changing a NULL column to NOT NULL. Later, we should evaluate the non-constant column values in these cases.
33 lines
1020 B
Plaintext
33 lines
1020 B
Plaintext
--source include/have_innodb.inc
|
|
|
|
CREATE TABLE t1 (
|
|
`i1` INT(10) UNSIGNED NOT NULL,
|
|
`d1` TIMESTAMP NULL DEFAULT NULL
|
|
) ENGINE=innodb;
|
|
|
|
SHOW CREATE TABLE t1;
|
|
|
|
INSERT INTO t1 (i1) VALUES (1), (2), (3), (4), (5);
|
|
select * from t1;
|
|
set sql_mode = 'STRICT_ALL_TABLES,NO_ZERO_DATE';
|
|
ALTER TABLE t1 CHANGE `d1` `d1` TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL;
|
|
drop table t1;
|
|
|
|
CREATE TABLE t1 (
|
|
`i1` INT(10) UNSIGNED NOT NULL,
|
|
`d1` TIMESTAMP NULL DEFAULT NULL
|
|
) ENGINE=innodb;
|
|
INSERT INTO t1 (i1) VALUES (1), (2), (3), (4), (5);
|
|
ALTER TABLE t1 CHANGE `d1` `d1` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
|
|
|
ALTER TABLE t1 ADD COLUMN d2 TIMESTAMP DEFAULT '2017-05-08 16:23:45',
|
|
LOCK=NONE;
|
|
--error ER_ALTER_OPERATION_NOT_SUPPORTED
|
|
ALTER TABLE t1 ADD COLUMN d3 TIMESTAMP DEFAULT d1, LOCK=NONE;
|
|
--error ER_ALTER_OPERATION_NOT_SUPPORTED
|
|
ALTER TABLE t1 ADD COLUMN d3 TIMESTAMP DEFAULT d1, ALGORITHM=INPLACE;
|
|
ALTER TABLE t1 ADD COLUMN d3 TIMESTAMP DEFAULT d1;
|
|
SELECT d1-d3, d2 FROM t1;
|
|
SHOW CREATE TABLE t1;
|
|
DROP TABLE t1;
|