TableParser doesn't handle column names with spaces
Bug #958061 reported by
Baron Schwartz
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,
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.
Changed in percona-toolkit: | |
status: | New → Confirmed |
tags: | added: ident-parsing whitespace |
Changed in percona-toolkit: | |
assignee: | nobody → Brian Fraser (fraserbn) |
Changed in percona-toolkit: | |
assignee: | Brian Fraser (fraserbn) → nobody |
To post a comment you must log in.
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)