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

RENAME tables locked with a write lock

Details

    • Task
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • None
    • None

    Description

      In MySQL 8, it's possible to use RENAME on a table that is locked with a write lock.
      https://dev.mysql.com/doc/refman/8.0/en/rename-table.html

      In MySQL 8, the following would work:

      CREATE TABLE t (id INT);
      LOCK TABLE t WRITE;
      RENAME TABLE t TO t2;
      

      In MariaDB, this fails with:

      RENAME TABLE t TO t2;
      ERROR 1192 (HY000): Can't execute the given command because you have active locked tables or an active transaction
      

      See also https://stackoverflow.com/questions/36202298/renaming-a-locked-table

      Attachments

        Issue Links

          Activity

            note that

            ALTER TABLE t RENAME TO t2;
            

            succeeds (in 10.6 at least) and that makes the table unaccessible, "table t2 was not locked with lock tables" error.

            serg Sergei Golubchik added a comment - note that ALTER TABLE t RENAME TO t2; succeeds (in 10.6 at least) and that makes the table unaccessible, "table t2 was not locked with lock tables" error.

            People

              Unassigned Unassigned
              greenman Ian Gilfillan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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