mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-05-28 04:36:06 -04:00
QueryColumnsProvider: Fully use up limit with custom variables
Previously custom variables that didn't match any of the desired sources were eating up the query's limit and so there is a chance that not even a single variable was listed. This especially occurs with the updated notifications integration, as the available database columns are very limited in number. But even in other views this may have been noticed by users in case they have many variables that are similarly named but have no overlap with database columns. (i.e. input that doesn't match any database columns but many vars)
This commit is contained in:
parent
bdc8561267
commit
5ea0724bb9
1 changed files with 10 additions and 3 deletions
|
|
@ -449,10 +449,17 @@ class QueryColumnsProvider implements IteratorAggregate
|
|||
|
||||
$customVars->columns($scalarQueries);
|
||||
$customVars->groupBy($idColumn);
|
||||
$customVars->limit(Suggestions::DEFAULT_LIMIT);
|
||||
|
||||
// This outer query exists only because there's no way to combine aggregates and sub queries (yet)
|
||||
return (new Select())->columns($aggregates)->from(['results' => $customVars])->groupBy('flatname');
|
||||
$outerQuery = (new Select())
|
||||
->columns($aggregates)
|
||||
->from(['results' => $customVars])
|
||||
->groupBy('flatname')
|
||||
->limit(Suggestions::DEFAULT_LIMIT);
|
||||
foreach ($scalarQueries as $name => $_) {
|
||||
$outerQuery->orHaving("MAX($name) = 1");
|
||||
}
|
||||
|
||||
return $outerQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue