Skip to content

Commit

Permalink
Group summaries: Do not use NULL for name columns
Browse files Browse the repository at this point in the history
Previously, all name columns in the UNION queries yield NULL except for
the Hostgroup or Servicegroup query. In PostgreSQL, this leads to
separate result sets because all SELECT columns must appear in the GROUP
BY clause, which also includes name columns.
  • Loading branch information
lippserd committed May 19, 2022
1 parent 7a8216b commit f65d0a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions library/Icingadb/Model/Hostgroupsummary.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ public function getUnions()
],
[
'hostgroup_id' => 'hostgroup.id',
'hostgroup_name' => new Expression('NULL'),
'hostgroup_display_name' => new Expression('NULL'),
'hostgroup_name' => 'hostgroup.name',
'hostgroup_display_name' => 'hostgroup.display_name',
'host_id' => 'host.id',
'host_state' => 'state.soft_state',
'host_handled' => 'state.is_handled',
Expand All @@ -126,8 +126,8 @@ public function getUnions()
],
[
'hostgroup_id' => 'hostgroup.id',
'hostgroup_name' => new Expression('NULL'),
'hostgroup_display_name' => new Expression('NULL'),
'hostgroup_name' => 'hostgroup.name',
'hostgroup_display_name' => 'hostgroup.display_name',
'host_id' => new Expression('NULL'),
'host_state' => new Expression('NULL'),
'host_handled' => new Expression('NULL'),
Expand Down
4 changes: 2 additions & 2 deletions library/Icingadb/Model/ServicegroupSummary.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ public function getUnions()
],
[
'servicegroup_id' => 'servicegroup.id',
'servicegroup_name' => new Expression('NULL'),
'servicegroup_display_name' => new Expression('NULL'),
'servicegroup_name' => 'servicegroup.name',
'servicegroup_display_name' => 'servicegroup.display_name',
'service_id' => 'service.id',
'service_state' => 'state.soft_state',
'service_handled' => 'state.is_handled',
Expand Down

0 comments on commit f65d0a8

Please sign in to comment.