Bug #105326 system view will be invalid with special characters table name
Submitted: 26 Oct 2021 12:13 Modified: 26 Oct 2021 12:42
Reporter: yi qian Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: SYS Schema Severity:S3 (Non-critical)
Version:8.0.25, 5.7.36 OS:Any
Assigned to: CPU Architecture:Any
Tags: sys.x$ps_schema_table_statistics_io

[26 Oct 2021 12:13] yi qian
Description:
System view sys.x$ps_schema_table_statistics_io will be invalid when statistics tables with special characters. This is because the view takes `FILE_NAME` of table performance_schema.file_summary_by_instance as table_name. However, for table whicn table name has special characters, file name and table name are inconsistent and have been converted. This will lead to sys.x$ps_schema_table_statistics_io invalid when statistics tables with special characters.

How to repeat:
1.prepare data:
mysql> create database testdb;
Query OK, 1 row affected (0.01 sec)

mysql> use testdb;
Database changed

mysql> create table `t`(id int not null);
Query OK, 0 rows affected (0.61 sec)

mysql> create table `t#`(id int not null);
Query OK, 0 rows affected (0.66 sec)

2.When the table name does not contain special characters:
mysql> select * from `sys`.`x$ps_schema_table_statistics_io` where table_name = 't'\G
*************************** 1. row ***************************
             table_schema: testdb
               table_name: t
               count_read: 0
 sum_number_of_bytes_read: 0
           sum_timer_read: 0
              count_write: 7
sum_number_of_bytes_write: 212992
          sum_timer_write: 1088754668
               count_misc: 6
           sum_timer_misc: 1015060064
1 row in set (0.07 sec)

3.When the table name contain special characters:
mysql> select * from `sys`.`x$ps_schema_table_statistics_io` where table_name = 't#'\G
Empty set (0.07 sec)
[26 Oct 2021 12:42] MySQL Verification Team
Hello yi qian,

Thank you for the report and test case.
Verified as described with 5.7.36 build.

regards,
Umesh