Bug #52586 Misleading error message on attempt to access a P_S table using a wrong name
Submitted: 4 Apr 2010 17:49 Modified: 4 Aug 2010 20:08
Reporter: Elena Stepanova Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Performance Schema Severity:S3 (Non-critical)
Version:5.5.3-m3, 5.5.4-m3 OS:Any
Assigned to: Marc ALFF CPU Architecture:Any

[4 Apr 2010 17:49] Elena Stepanova
Description:
On case-sensitive systems, an attempt to access a performance schema table using a lower-case name (which is wrong) causes ERROR 1142 (command denied to user). For a regular schema/table it is ERROR 1146 (table doesn't exist).

The error message is misleading as it implies a user does not have enough permissions to access the table, rather than that something is wrong with his query.

If wrong case is used for the database name, server returns error 1146.

How to repeat:
# Misleading error:

select count(*) from performance_schema.setup_instruments;
ERROR 1142 (42000): SELECT command denied to user 'root'@'localhost' for table 'setup_instruments'

# For database names, error is different
# (it also happens to regular tables' names):

select count(*) from PERFORMANCE_SCHEMA.SETUP_INSTRUMENTS;
ERROR 1146 (42S02): Table 'PERFORMANCE_SCHEMA.SETUP_INSTRUMENTS' doesn't exist

# This is to show that proper select works all right:

select count(*) from performance_schema.SETUP_INSTRUMENTS;
+----------+
| count(*) |
+----------+
|      221 |
+----------+
1 row in set (0.00 sec)

Suggested fix:
Return ERROR 1146 instead of ERROR 1142 if wrong case is used in P_S table names.
[4 Apr 2010 18:12] Elena Stepanova
Same happens if the name is just wrong (the table does not exist in P_S, neither in lower case nor in upper case) -- the error is still 1142.
[7 Apr 2010 8:53] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/105128

3144 Marc Alff	2010-04-07
      Bug#52586 Misleading error message on attempt to access a P_S table using a wrong name
      
      Before this fix,
        select * from performance_schema.no_such_table
      would fail with ER_TABLEACCESS_DENIED_ERROR,
      because the performance schema code automatically
      denied SELECT_ACL on performance_schema.*.
      
      With this fix, SELECT_ACL on performance_schema.*
      is not premptively rejected,
      so that:
        select * from performance_schema.no_such_table
      now fails later in the code execution with ER_NO_SUCH_TABLE.
       
      The statement still fails, as expected, 
      but returning a more detailed error
      (that now discloses the information that the table really does not exist)
      is better for ease of use.
[20 Apr 2010 9:15] Marc ALFF
Approved by Kevin by email
[21 Apr 2010 7:17] Marc ALFF
Pushed into:
- mysql-next-mr-bugfixing
- mysql-6.0-codebase-bugfixing
[27 Apr 2010 9:45] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100427094135-5s49ecp3ckson6e2) (version source revid:alik@sun.com-20100427093843-uekr85qkd7orx12t) (merge vers: 6.0.14-alpha) (pib:16)
[27 Apr 2010 9:51] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100427094036-38frbg3famdlvjup) (version source revid:alik@sun.com-20100427093825-92wc8b22d4yg34ju) (pib:16)
[8 May 2010 21:59] Paul DuBois
Noted in 6.0.14 changelog.

Attempts to access a nonexistent table in the performance_schema
database resulted in a misleading error message.
[15 Jul 2010 23:41] Marc ALFF
This bug is tagged SR55MRU, but the fix is only present in 5.6, not 5.5

Changing to need merge, to merge the fix in mysql-trunk (5.5)
[15 Jul 2010 23:57] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/113716

3116 Marc Alff	2010-07-15
      Bug#52586 Misleading error message on attempt to access a P_S table using a wrong name
      
      Backport from mysql-next-mr (5.6) to mysql-trunk (5.5)
[16 Jul 2010 0:34] Marc ALFF
Pushed into mysql-trunk-bugfixing (5.5.6)
[22 Jul 2010 16:14] Paul DuBois
Noted in 5.5.6 changelog.
[23 Jul 2010 12:28] Bugs System
Pushed into mysql-trunk 5.5.6-m3 (revid:alik@sun.com-20100723121820-jryu2fuw3pc53q9w) (version source revid:vasil.dimov@oracle.com-20100531152341-x2d4hma644icamh1) (merge vers: 5.5.5-m3) (pib:18)
[23 Jul 2010 12:35] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100723121929-90e9zemk3jkr2ocy) (version source revid:vasil.dimov@oracle.com-20100531152341-x2d4hma644icamh1) (pib:18)
[4 Aug 2010 8:03] Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@ibmvm-20100804080001-bny5271e65xo34ig) (version source revid:alik@sun.com-20100427095914-pzlxbqjjtnngxmf0) (merge vers: 5.6.99-m4) (pib:18)
[4 Aug 2010 8:20] Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@ibmvm-20100804081533-c1d3rbipo9e8rt1s) (version source revid:alik@sun.com-20100427095914-pzlxbqjjtnngxmf0) (merge vers: 5.6.99-m4) (pib:18)
[4 Aug 2010 20:08] Paul DuBois
Bug is not present in any released 5.6.x version.