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

Couldn't alter field with default value for make it not nullable.

Details

    • 10.1.6-2

    Description

      Reproduction:

      1) Create table

      CREATE TABLE `table2` (
        `i1` INT(10) UNSIGNED NOT NULL,
        `d1` TIMESTAMP NULL DEFAULT NULL
      ) ENGINE=INNODB;

      2) Fill table

      INSERT INTO table2 (i1) VALUES (1), (2), (3), (4), (5);

      3) Try Alter table with making field `d1` not nullable with default value CURRENT_TIMESTAMP

      ALTER TABLE `table2`   
        CHANGE `d1` `d1` TIMESTAMP DEFAULT CURRENT_TIMESTAMP  NOT NULL

      Error happens here:

      Error Code: 1138
      Invalid use of NULL value

      Expected that column `d1` will be filled with NOW() value

      SELECT @@sql_mode

      @@sql_mode                                                                                                                 
      ---------------------------------------------------------------------------------------------------------------------------
      NO_BACKSLASH_ESCAPES,STRICT_ALL_TABLES,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION  

      In continue bug https://mariadb.atlassian.net/browse/MDEV-6880 but also needed with already created fields.

      Attachments

        Issue Links

          Activity

            mikhail Mikhail Gavrilov created issue -
            elenst Elena Stepanova made changes -
            Field Original Value New Value
            Status Open [ 1 ] Confirmed [ 10101 ]
            elenst Elena Stepanova made changes -
            Fix Version/s 10.1 [ 16100 ]
            Fix Version/s 10.0 [ 16000 ]
            Affects Version/s 10.1 [ 16100 ]
            Affects Version/s 10.0 [ 16000 ]
            Affects Version/s 10.0.20 [ 19201 ]
            Assignee Jan Lindström [ jplindst ]
            Labels upstream
            jplindst Jan Lindström (Inactive) made changes -
            Sprint 10.1.6-2 [ 7 ]
            jplindst Jan Lindström (Inactive) made changes -
            Status Confirmed [ 10101 ] In Progress [ 3 ]
            jplindst Jan Lindström (Inactive) made changes -
            Component/s Storage Engine - InnoDB [ 10129 ]
            Component/s Storage Engine - XtraDB [ 10135 ]
            Fix Version/s 10.0.21 [ 19406 ]
            Fix Version/s 10.1.6 [ 19401 ]
            Fix Version/s 10.0 [ 16000 ]
            Fix Version/s 10.1 [ 16100 ]
            Resolution Fixed [ 1 ]
            Status In Progress [ 3 ] Closed [ 6 ]
            marko Marko Mäkelä made changes -
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 70348 ] MariaDB v4 [ 149315 ]

            People

              jplindst Jan Lindström (Inactive)
              mikhail Mikhail Gavrilov
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.