Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.3(EOL)
Description
When the table-rebuilding "inplace" ALTER TABLE was introduced in MySQL 5.6, one of the supported operations was the change of the NULL / NOT NULL attribute. Introducing a NOT NULL constraint can fail when the column actually contains a NULL value in some row. However, if SQL_MODE does not include STRICT_TRANS_TABLES or STRICT_ALL_TABLES, the column contents should be replaced with the implicit or explicit DEFAULT value of the column, just like ALGORITHM=COPY does it.
MDEV-11369 allows instant ADD COLUMN…NOT NULL without specifying a DEFAULT value, even when rows exist in the table. Just like what would happen with ALGORITHM=COPY or with ALGORITHM=INPLACE before the instant ADD was implemented, the implicit default value of the data type will be applied.
It would be consistent with the ADD COLUMN behaviour to allow changing an existing column to NOT NULL in non-strict mode, replacing any NULL values with the implicit or explicit default value. Such operation would naturally allow LOCK=NONE operation, even when there are concurrent INSERT or UPDATE of NULL values.
Attachments
Issue Links
- causes
-
MDEV-16126 Crash or ASAN heap-buffer-overflow in mach_read_from_n_little_endian upon ALTER TABLE with blob
- Closed
-
MDEV-16365 Setting a column NOT NULL fails to return error for NULL values when there is no DEFAULT
- Closed
- relates to
-
MDEV-18732 InnoDB: Wrong results in ALTER IGNORE TABLE with ALGORITHM=INPLACE
- Closed
-
MDEV-11369 Instant add column for InnoDB
- Closed