[MDEV-30814] RENAME tables locked with a write lock Created: 2023-03-08  Updated: 2023-03-30

Status: Open
Project: MariaDB Server
Component/s: None
Fix Version/s: None

Type: Task Priority: Major
Reporter: Ian Gilfillan Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: compat80

Issue Links:
PartOf
is part of MDEV-28906 MySQL 8.0 desired compatibility Open

 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



 Comments   
Comment by Sergei Golubchik [ 2023-03-30 ]

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.

Generated at Thu Feb 08 10:19:06 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.