constraints_parser.c can't process a field that its name is reserved keyword

Bug #1610495 reported by gengchc2
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Data Recovery Tool for InnoDB
New
Undecided
gengchc2

Bug Description

constraints_parser.c can't process a field that its name is reserved keyword.such as:
CREATE TABLE `credential` (
  `id` varchar(64) NOT NULL,
  `user_id` varchar(64) NOT NULL,
  `project_id` varchar(64) DEFAULT NULL,
  `blob` blob NOT NULL,
  `type` varchar(255) NOT NULL,
  `extra` blob,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

The field 'blob' is reserved keyword.

constraints_parser.c generate load data statement:
SET FOREIGN_KEY_CHECKS=0;
LOAD DATA INFILE '/opt/3320/new_data/keystone/credential/dumps/default/credential' REPLACE INTO TABLE `credential` FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES STARTING BY 'credential\t' (`id`, `user_id`, `project_id`, @var_blob, `type`, @var_extra)
SET
    blob = UNHEX(@var_blob),
    extra = UNHEX(@var_extra);

ERROR 1064 (42000) at line 2 in file: '/opt/3320/new_data/keystone/credential.loaddata': You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'blob = UNHEX(@var_blob),
    extra = UNHEX(@var_extra)' at line 3

The correct load data statement is :
SET FOREIGN_KEY_CHECKS=0;
LOAD DATA INFILE '/opt/3320/new_data/keystone/credential/dumps/default/credential' REPLACE INTO TABLE `credential` FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES STARTING BY 'credential\t' (`id`, `user_id`, `project_id`, @var_blob, `type`, @var_extra)
SET
    `blob` = UNHEX(@var_blob),
    `extra` = UNHEX(@var_extra);

By the way,Can I submit the correct code ?

gengchc2 (578043796-b)
Changed in percona-data-recovery-tool-for-innodb:
assignee: nobody → gengchc2 (578043796-b)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.