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

table alias from previous statement interferes later commands

    XMLWordPrintable

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

            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.