PT-193 Fixed regex in TableParser

TableParser's parse function was failing while trying to lowercase
column names in the provided 'SHOW CREATE TABLE'.
The problem was it was trying to lowercase everything between backticks
but lines like these:

`field_name` int comment "here is a ` in the comment"
`second_field_name` int

made the original regex to fail, matching `in the coment"` as an
expression to be lowercased while second_file_name was considered as
outside backticks.
This commit is contained in:
Carlos Salguero
2017-08-14 21:01:30 -03:00
parent a54525cb54
commit c375fd068b
3 changed files with 33 additions and 1 deletions

View File

@@ -145,7 +145,7 @@ sub parse {
# Lowercase identifiers to avoid issues with case-sensitivity in Perl.
# (Bug #1910276).
$ddl =~ s/(`[^`]+`)/\L$1/g;
$ddl =~ s/(`[^`\n]+`)/\L$1/gm;
my $engine = $self->get_engine($ddl);