[MDEV-13176] ALTER TABLE…CHANGE col col TIMESTAMP NOT NULL DEFAULT… fails Created: 2017-06-26  Updated: 2017-06-27  Resolved: 2017-06-27

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Alter Table, Storage Engine - InnoDB
Affects Version/s: 10.2
Fix Version/s: 10.2.7, 10.3.1

Type: Bug Priority: Major
Reporter: Marko Mäkelä Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: alter

Issue Links:
Relates
relates to MDEV-11369 Instant add column for InnoDB Closed
relates to MDEV-12586 ALTER TABLE…ALGORITHM=INPLACE fails w... Closed

 Description   

When it comes to DEFAULT values of columns, InnoDB is imposing both unnecessary and insufficient conditions on whether ALGORITHM=INPLACE should be allowed for ALTER TABLE.

When changing an existing column to NOT NULL, any NULL values in the columns only get a special treatment if the column is changed to an AUTO_INCREMENT column (which is not supported by ALGORITHM=INPLACE) or the column type is TIMESTAMP. In all other cases, an error must be reported for the inability to convert the NULL value to NOT NULL.

InnoDB was unnecessarily interested in whether the DEFAULT value is not constant when altering other than TIMESTAMP columns. Also, when changing a TIMESTAMP column to NOT NULL, InnoDB was performing an insufficient check, and it was incorrectly allowing a constant DEFAULT value while not being able to replace NULL values with that constant value.

Furthermore, in ADD COLUMN, InnoDB is unnecessarily rejecting certain nondeterministic DEFAULT expressions (depending on the session parameters or the current time).


Generated at Thu Feb 08 08:03:30 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.