Bug #109711 mysqlimport doesn't escape reserved-word table names when used with --delete
Submitted: 19 Jan 20:24 Modified: 6 Mar 20:58
Reporter: Brad Waite Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:8.0.31, 8.0.32 OS:Any
Assigned to: CPU Architecture:Any
Tags: mysqlimport

[19 Jan 20:24] Brad Waite
Description:
When using mysqlimport to load a table with a reserved-word name, the data is loaded as expected. However, when using the --delete option, a 1064 error is thrown.

How to repeat:
$ mysql tmpfoo -e 'CREATE TABLE IF NOT EXISTS `KEY` (`ID` INT NOT NULL DEFAULT 0, `TXT` VARCHAR(5), PRIMARY KEY (`ID`)) ENGINE=InnoDB DEFAULT CHARSET=utf8'
$ echo -n "0\tOne\n1\tTwo\n2\tThree" > KEY.txt
$ mysqlimport --local tmpfoo KEY.txt
tmpfoo.KEY: Records: 3  Deleted: 0  Skipped: 0  Warnings: 0
$ mysqlimport --local --delete tmpfoo KEY.txt
mysqlimport: Error: 1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'KEY' at line 1, when using table: KEY

Suggested fix:
Properly back-tick-quote table names in the DELETE statement, as they are in the LOAD DATA statement.
[20 Jan 7:44] MySQL Verification Team
Hello Brad Waite,

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

regards,
Umesh
[25 Jan 4:33] MySQL Verification Team
Bug #109712 marked as duplicate of this one
[6 Mar 20:58] Philip Olson
Posted by developer:
 
Fixed as of the upcoming MySQL Server 8.0.33 release, and here's the proposed changelog entry from the documentation team:

mysqlimport did not escape reserved word table names when used with the --delete option.

Thank you for the bug report.