mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 05:29:30 +00:00
Fix for 996069: Incorrect RES.001 when using aggregate functions
This commit is contained in:
@@ -3815,6 +3815,7 @@ sub get_rules {
|
||||
return unless scalar %groupby_col;
|
||||
my $cols = [
|
||||
grep { _looks_like_column($_->{col}) }
|
||||
grep { ! exists $_->{func} }
|
||||
@{$event->{query_struct}->{columns}}
|
||||
];
|
||||
foreach my $col ( @$cols ) {
|
||||
|
@@ -344,6 +344,7 @@ sub get_rules {
|
||||
# Skip non-columns -- NULL, digits, functions, variables
|
||||
my $cols = [
|
||||
grep { _looks_like_column($_->{col}) }
|
||||
grep { ! exists $_->{func} }
|
||||
@{$event->{query_struct}->{columns}}
|
||||
];
|
||||
# All SELECT cols must be in GROUP BY cols clause.
|
||||
|
@@ -471,6 +471,11 @@ my @cases = (
|
||||
query => q{select NULL, 1, COUNT(*), @@time_zone, foo as field2 from t1 group by field2},
|
||||
advice => [qw(CLA.001)],
|
||||
},
|
||||
{
|
||||
name => 'Bug 996069: wrong RES.001',
|
||||
query => q{SELECT cola, MAX(colb) FROM table WHERE cola = 123 GROUP BY cola},
|
||||
advice => [qw()],
|
||||
},
|
||||
);
|
||||
|
||||
# Run the test cases.
|
||||
|
Reference in New Issue
Block a user