Fix PostgreSQL queries that use GROUP BY

Add missing instance_id to getGroup query functions to avoid query errors in PostgreSQL.

fixes #10160
This commit is contained in:
Matthias Jentsch 2015-09-17 16:03:42 +02:00
parent 8cea292745
commit 3b135c6b6f
8 changed files with 30 additions and 0 deletions

View File

@ -181,6 +181,10 @@ class HostcommentQuery extends IdoQuery
if ($this->hasJoinedVirtualTable('hoststatus')) {
$group[] = 'hs.hoststatus_id';
}
if ($this->hasJoinedVirtualTable('instances')) {
$group[] = 'i.instance_id';
}
}
return $group;

View File

@ -187,6 +187,10 @@ class HostdowntimeQuery extends IdoQuery
if ($this->hasJoinedVirtualTable('hoststatus')) {
$group[] = 'hs.hoststatus_id';
}
if ($this->hasJoinedVirtualTable('instances')) {
$group[] = 'i.instance_id';
}
}
return $group;

View File

@ -265,6 +265,10 @@ class HostnotificationQuery extends IdoQuery
if ($this->hasJoinedVirtualTable('acknowledgements')) {
$group[] = 'a.acknowledgement_id';
}
if ($this->hasJoinedVirtualTable('instances')) {
$group[] = 'i.instance_id';
}
}
return $group;

View File

@ -336,6 +336,9 @@ class HoststatusQuery extends IdoQuery
$group[] = 'so.object_id';
$group[] = 's.service_id';
break;
case 'instances':
$group[] = 'i.instance_id';
break;
default:
continue 2;
}

View File

@ -203,6 +203,10 @@ class ServicecommentQuery extends IdoQuery
if ($this->hasJoinedVirtualTable('servicestatus')) {
$group[] = 'ss.servicestatus_id';
}
if ($this->hasJoinedVirtualTable('instances')) {
$group[] = 'i.instance_id';
}
}
return $group;

View File

@ -210,6 +210,10 @@ class ServicedowntimeQuery extends IdoQuery
if ($this->hasJoinedVirtualTable('servicestatus')) {
$group[] = 'ss.servicestatus_id';
}
if ($this->hasJoinedVirtualTable('instances')) {
$group[] = 'i.instance_id';
}
}
return $group;

View File

@ -268,6 +268,10 @@ class ServicenotificationQuery extends IdoQuery
if ($this->hasJoinedVirtualTable('acknowledgements')) {
$group[] = 'a.acknowledgement_id';
}
if ($this->hasJoinedVirtualTable('instances')) {
$group[] = 'i.instance_id';
}
}
return $group;

View File

@ -452,6 +452,9 @@ class ServicestatusQuery extends IdoQuery
case 'hoststatus':
$group[] = 'hs.hoststatus_id';
break;
case 'instances':
$group[] = 'i.instance_id';
break;
case 'servicestatus':
$group[] = 'ss.servicestatus_id';
break;