Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
5.5(EOL), 10.0(EOL), 10.1(EOL), 10.2(EOL), 10.3(EOL)
-
None
Description
If you try to execute FLUSH TABLES on a view after read-locking that view with LOCK TABLES ... READ|WRITE, then you get an error message that doesn't seem to make a lot of sense.
For example, if we have this view:
CREATE TABLE t (qty INT, price INT);
|
CREATE VIEW v AS SELECT qty, price, qty*price AS value FROM t;
|
Then let's see what happens:
MariaDB [db1]> LOCK TABLES v READ;
|
Query OK, 0 rows affected (0.00 sec)
|
|
MariaDB [db1]> FLUSH TABLES v;
|
ERROR 1100 (HY000): Table 'v' was not locked with LOCK TABLES
|
If we execute the same statement on the base table, then we get a different error message:
MariaDB [db1]> LOCK TABLES t READ;
|
Query OK, 0 rows affected (0.00 sec)
|
|
MariaDB [db1]> FLUSH TABLES t;
|
ERROR 1099 (HY000): Table 't' was locked with a READ lock and can't be updated
|
Trying to flush a write-locked view has the same problem:
MariaDB [db1]> LOCK TABLES v WRITE;
|
Query OK, 0 rows affected (0.00 sec)
|
|
MariaDB [db1]> FLUSH TABLES v;
|
ERROR 1100 (HY000): Table 'v' was not locked with LOCK TABLES
|
But this does work for base tables:
MariaDB [db1]> LOCK TABLES t WRITE;
|
Query OK, 0 rows affected (0.00 sec)
|
|
MariaDB [db1]> FLUSH TABLES t;
|
Query OK, 0 rows affected (0.00 sec)
|
Is the error message wrong, or is FLUSH partially broken for views at the moment?
Attachments
Issue Links
- relates to
-
MDEV-15888 Implement FLUSH TABLES tbl_name [, tbl_name] ... WITH READ LOCK for views
- Closed