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

Improve and unify error messages on ALTER TABLE ... RENAME to unknown db

    XMLWordPrintable

Details

    Description

      CREATE TABLE t (c INT) ENGINE=InnoDB;
      ALTER TABLE t RENAME a.t;
      

      On MySQL 8.0 will give:

      8.0.29-opt>ALTER TABLE t RENAME a.t;
      ERROR 1049 (42000): Unknown database 'a'
      

      This will be the same output, no matter what the engine or options (like partitioning) are.

      On MariaDB 10.10 we see a variety of outputs:

      CREATE TABLE t (c INT) ENGINE=InnoDB;
      ALTER TABLE t RENAME a.t;
      

      Leads to:

      10.10.0 081a284712bb661349e2e3802077b12211cede3e (Optimized)

      10.10.0-opt>ALTER TABLE t RENAME a.t;
      ERROR 1025 (HY000): Error on rename of './test/t' to './a/t' (errno: 168 "Unknown (generic) error from engine")
      

      And for MyISAM/Aria:

      CREATE TABLE t (c INT) ENGINE=MyISAM;
      ALTER TABLE t RENAME a.t;
      

      Leads to:

      10.10.0 081a284712bb661349e2e3802077b12211cede3e (Optimized)

      10.10.0-opt>ALTER TABLE t RENAME a.t;
      ERROR 7 (HY000): Error on rename of './test/t.MYI' to './a/t.MYI' (Errcode: 20 "Not a directory")
      

      And

      CREATE TABLE t (c INT) ENGINE=InnoDB;
      ALTER TABLE t PARTITION BY LIST (c) (PARTITION p VALUES IN (1,2));
      ALTER TABLE t RENAME a.t;
      

      Leads to a similar message as the InnoDB testcase above, but we also see in the error log:

      10.10.0 081a284712bb661349e2e3802077b12211cede3e (Optimized)

      2022-06-14 13:57:04 4 [ERROR] InnoDB: Cannot rename file './test/t#P#p.ibd' to './a/t#P#p.ibd'
      

      And for MEMORY and Spider (which both seem to correctly report the right error);

      # INSTALL PLUGIN spider SONAME 'ha_spider.so';  # For Spider 
      CREATE TABLE t (c INT) ENGINE=MEMORY;  # or ENGINE=Spider for Spider
      ALTER TABLE t RENAME a.t;
      

      We see:

      10.10.0 081a284712bb661349e2e3802077b12211cede3e (Optimized)

      10.10.0-opt>ALTER TABLE t RENAME a.t;
      ERROR 1049 (42000): Unknown database 'a'
      

      For RocksDB:

      INSTALL SONAME 'ha_rocksdb.so';
      CREATE TABLE t (c INT) ENGINE=rocksdb;
      ALTER TABLE t RENAME a.t;
      

      Leads to:

      10.10.0 081a284712bb661349e2e3802077b12211cede3e (Optimized)

      10.10.0-opt>ALTER TABLE t RENAME a.t;
      ERROR 1025 (HY000): Error on rename of './test/t' to './a/t' (errno: -1 "Internal error < 0 (Not system error)")
      

      Bug fix: change all various engine messages to a uniform:

      ERROR 1049 (42000): Unknown database 'a'
      

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.