Add func to col ident struct to fix QueryAdvisorRules.t.

This commit is contained in:
Daniel Nichter
2012-04-03 11:03:17 -06:00
parent dcec863988
commit c3b99d17a1
3 changed files with 8 additions and 3 deletions

View File

@@ -1299,8 +1299,9 @@ sub parse_identifier {
return unless $type && $ident;
PTDEBUG && _d("Parsing", $type, "identifier:", $ident);
my ($func, $expr);
if ( $ident =~ m/^\w+\(/ ) { # Function like MIN(col)
my ($func, $expr) = $ident =~ m/^(\w+)\(([^\)]*)\)/;
($func, $expr) = $ident =~ m/^(\w+)\(([^\)]*)\)/;
PTDEBUG && _d('Function', $func, 'arg', $expr);
return { col => $ident } unless $expr; # NOW()
$ident = $expr; # col from MAX(col)
@@ -1340,6 +1341,10 @@ sub parse_identifier {
}
}
if ( $func ) {
$ident_struct{func} = uc $func;
}
PTDEBUG && _d($type, "identifier struct:", Dumper(\%ident_struct));
return \%ident_struct;
}