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

ALTER TABLE…CHANGE col col TIMESTAMP NOT NULL DEFAULT… fails

    Details

      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).

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: