mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-19611 INPLACE ALTER does not fail on bad implicit default value
- Inplace alter shouldn't set default date column as '0000-00-00' when table is not empty. So mysql_inplace_alter_table() copied alter_ctx.error_if_not_empty to a new field of Alter_inplace_info. In ha_innobase::check_if_supported_inplace_alter() should check the error_if_not_empty flag and return INPLACE_NOT_SUPPORTED if the table is not empty
This commit is contained in:
@ -124,3 +124,18 @@ SELECT DISTINCT (CURRENT_TIMESTAMP()-d4) <= 60 FROM t1;
|
||||
(CURRENT_TIMESTAMP()-d4) <= 60
|
||||
1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(f1 int) ENGINE=InnoDB;
|
||||
INSERT INTO t1 SELECT * FROM seq_1_to_4096;
|
||||
connect purge_control,localhost,root,,;
|
||||
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
||||
connection default;
|
||||
DELETE FROM t1;
|
||||
SET sql_mode='STRICT_ALL_TABLES,STRICT_TRANS_TABLES,NO_ZERO_DATE';
|
||||
ALTER TABLE t1 ADD f2 DATE NOT NULL, ALGORITHM=INPLACE;
|
||||
INSERT INTO t1 VALUES (1, now());
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'f2' at row 1
|
||||
ALTER TABLE t1 ADD f3 DATE NOT NULL, ALGORITHM=INPLACE;
|
||||
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
|
||||
DROP TABLE t1;
|
||||
disconnect purge_control;
|
||||
|
Reference in New Issue
Block a user