Bug #98068 SELECT FOR UPDATE not-exist table in PERFORMANCE SCHEMA reports confusing error
Description:
Set current database to performance_schema, and select a not-exist table for update, the error message is:
ERROR 1142 (42000): SELECT with locking clause command denied to user 'root'@'localhost' for table 'not_exist_table'
which should be,
ERROR 1146 (42S02): Table 'performance_schema.not_exist_table' doesn't exist
If set current database to information_schema, then do the same selects, the error message is different.
How to repeat:
$ sudo mysql -uroot test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.18-0ubuntu0.19.10.1 (Ubuntu)
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select * from not_exist_table;
ERROR 1146 (42S02): Table 'test.not_exist_table' doesn't exist
mysql> select * from not_exist_table for update;
ERROR 1146 (42S02): Table 'test.not_exist_table' doesn't exist
mysql> use performance_schema;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql>
mysql> select * from not_exist_table;
ERROR 1146 (42S02): Table 'performance_schema.not_exist_table' doesn't exist. ===> EXPECTED
mysql> select * from not_exist_table for update;
ERROR 1142 (42000): SELECT with locking clause command denied to user 'root'@'localhost' for table 'not_exist_table' ===> NOT EXPECTED
mysql> use information_schema;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select * from not_exist_table;
ERROR 1109 (42S02): Unknown table 'NOT_EXIST_TABLE' in information_schema. ===> EXPECTED?
mysql> select * from not_exist_table for update;
ERROR 1109 (42S02): Unknown table 'NOT_EXIST_TABLE' in information_schema. ===> EXPECTED?
Suggested fix:
1. Fix the error message as sth. like
ERROR 1146 (42S02): Table 'performance_schema.not_exist_table' doesn't exist.
2. Make sure the error messages are consistent whether current database is performance_schema or not.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.053 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.