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

table alias from previous statement interferes later commands

Details

    Description

      When an Update Statement happens with an alias. The alias seems to replace the table name.

      See below an example Query to reproduce the failure:

      DROP TABLE IF EXISTS `test_table`;
       
      CREATE TABLE `test_table` (
        `id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,
        `order_date` datetime NOT NULL,
        `language_id` BINARY(16) NULL 
      );
       
      ALTER TABLE `test_table` CHANGE `order_date` `order_date_time` DATETIME(3) NOT NULL;
       
      ALTER TABLE `test_table` ADD COLUMN `order_date` DATE GENERATED ALWAYS AS (CONVERT(`order_date_time`, DATE)) STORED AFTER `order_date_time`;
       
      UPDATE `test_table` as `x` SET order_date = NULL;
       
      ALTER TABLE `test_table` MODIFY COLUMN `language_id` BINARY(16) NOT NULL;
      

      Results in the following error on the ALTER TABLE statement:

      Unknown column '`test`.`x`.`order_date_time`' in 'GENERATED ALWAYS'
      

      Attachments

        Issue Links

          Activity

            Please review 2 commits in bb-10.2-midenok

            midenok Aleksey Midenkov added a comment - Please review 2 commits in bb-10.2-midenok
            nikitamalyavin Nikita Malyavin added a comment - - edited

            FYI git bisect points to
            42f8548f MDEV-25091 CREATE TABLE: field references qualified by a wrong table name succeed

            nikitamalyavin Nikita Malyavin added a comment - - edited FYI git bisect points to 42f8548f MDEV-25091 CREATE TABLE: field references qualified by a wrong table name succeed
            midenok Aleksey Midenkov added a comment - - edited

            nikitamalyavin just look at Issue Links caused by.

            midenok Aleksey Midenkov added a comment - - edited nikitamalyavin just look at Issue Links caused by.
            midenok Aleksey Midenkov added a comment - - edited

            ralf.gebhardt@mariadb.com serg If there is no time for this fix to be properly tested then MDEV-25091 should be reverted until the fix pushed.

            midenok Aleksey Midenkov added a comment - - edited ralf.gebhardt@mariadb.com serg If there is no time for this fix to be properly tested then MDEV-25091 should be reverted until the fix pushed.

            I'd rather push a one-liner, as discussed on slack. I'll fix the bug without reopening MDEV-25091.

            serg Sergei Golubchik added a comment - I'd rather push a one-liner, as discussed on slack. I'll fix the bug without reopening MDEV-25091 .

            People

              serg Sergei Golubchik
              shyim Soner Sayakci
              Votes:
              0 Vote for this issue
              Watchers:
              11 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.