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

ALTER TABLE wrongly checks for field's default value if AFTER is used

    XMLWordPrintable

Details

    Description

      See the following test script:

      CREATE TABLE test(
      t text NOT NULL,
      d date NOT NULL
      );
       
      insert into test values ("x",CURRENT_DATE());
       
      SET SESSION sql_mode = "STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE";
       
      ALTER TABLE test
      CHANGE d d DATE  NOT NULL AFTER t,
       ADD i text NOT NULL AFTER d
      ;
      

      Resulting in
      Error (1292): Incorrect date value: '0000-00-00' for column `test`.`d` at row 1

      As you can see this is totally wrong, there is no such value 0000-00-00 in this table, and the alter statement should succeed.

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              mokraemer Marc
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.