Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-14168

Unconditionally allow ALGORITHM=INPLACE for setting a column NOT NULL

    Details

      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

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                marko Marko Mäkelä
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: