TableParser doesn't handle column names with spaces

Bug #958061 reported by Baron Schwartz
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Toolkit moved to https://jira.percona.com/projects/PT
Confirmed
Undecided
Unassigned

Bug Description

This code in get_fks() looks very wrong to me:

      $fks->{$name} = {
         name => $name,
         colnames => $cols,
         cols => [ map { s/[ `]+//g; $_; } split(',', $cols) ],
         parent_tbl => \%parent_tbl,
         parent_tblname => $parent,
         parent_cols => [ map { s/[ `]+//g; $_; } split(',', $parent_cols) ],
         parent_colnames=> $parent_cols,
         ddl => $fk,
      };

It is replacing [ `] with nothing. That means that a foreign key like this,

REFERENCES foo (`abc def`)

is going to come out as abcdef which is wrong.

Revision history for this message
Baron Schwartz (baron-xaprb) wrote :

This will also break:

mysql> create table t(`abc``def` int);
Query OK, 0 rows affected (0.08 sec)

mysql> show create table t\G
*************************** 1. row ***************************
       Table: t
Create Table: CREATE TABLE `t` (
  `abc``def` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

Brian Fraser (fraserbn)
Changed in percona-toolkit:
status: New → Confirmed
tags: added: ident-parsing whitespace
Brian Fraser (fraserbn)
Changed in percona-toolkit:
assignee: nobody → Brian Fraser (fraserbn)
Changed in percona-toolkit:
assignee: Brian Fraser (fraserbn) → nobody
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PT-951

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.