Bug #97848 MySQL backup_progress table has MySQL reserved key word lead wrong query result
Submitted: 2 Dec 2019 13:31 Modified: 3 Dec 2019 12:06
Reporter: Xinglong Fan Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Enterprise Backup Severity:S3 (Non-critical)
Version:4.0, 4.1, 4.1.3 OS:Any
Assigned to: CPU Architecture:Any

[2 Dec 2019 13:31] Xinglong Fan
Description:
Hi, there is an issue under MEB history table.

Query A:

select * from mysql.backup_progress where current_time > '2019-11-01';
result = 0 row.----Not correct

But
Query B: 
select * from mysql.backup_progress a where current_time > '2019-11-01';
result = actual rows

Query C:
select * from mysql.backup_progress a where `current_time` > '2019-11-01';
result = actual rows.

Query A can't retrun expected rows, because the current_time is reversed key word/function in MySQL.

How to repeat:

MySQL Verison: 5.7
MySQL MEB: 4.1

Step1:
you need backup records in your mysql.backup_progress table.

Step2:
select * from mysql.backup_progress where current_time > '2019-11-01';
result = 0 row.----Not correct

Step3:

desc
select * from (select * from mysql.backup_progress) a
where current_time>'2019-11-00';
show warnings;

you will get: 

/* select#1 */ select `mysql`.`backup_progress`.`backup_id` AS `backup_id`,`mysql`.`backup_progress`.`tool_name` AS `tool_name`,`mysql`.`backup_progress`.`error_code` AS `error_code`,`mysql`.`backup_progress`.`error_message` AS `error_message`,`mysql`.`backup_progress`.`current_time` AS `current_time`,`mysql`.`backup_progress`.`current_state` AS `current_state` 
from `mysql`.`backup_progress` where 0

You can find the criteria after `where` is equals to 0.

which is actually been translate as: where current_time-->current_time() 'hh-mi-s'
of cause it will not grater than the date.

and I can find that, all the current**** function can run without the ();

like 
select current_date;
select current_time;
select current_timestamp;
select current_user;

Suggested fix:
1. Change the filed name to other name which not the key reversed name from MySQL.
2. Make sure this change can be logged in the release note to avoid some project use the old filed as monitoring.
or any other suggestion from MySQL team.
[3 Dec 2019 12:06] MySQL Verification Team
Hello Xinglong Fan,

Thank you for the report and feedback.

regards,
Umesh