From a9c63cf32528095ed1c73580c193cf32686c5200 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 1 Mar 2016 04:27:04 +0100 Subject: [PATCH] IcingaHostTable: order related objects for pgsql --- application/tables/IcingaHostTable.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/application/tables/IcingaHostTable.php b/application/tables/IcingaHostTable.php index ec4e2869..cf523786 100644 --- a/application/tables/IcingaHostTable.php +++ b/application/tables/IcingaHostTable.php @@ -13,10 +13,11 @@ class IcingaHostTable extends IcingaObjectTable public function getColumns() { - if ($this->connection()->getDbType() === 'pgsql') - $parents = "ARRAY_TO_STRING(ARRAY_AGG(ih.object_name), ', ')"; - else + if ($this->connection()->getDbType() === 'pgsql') { + $parents = "ARRAY_TO_STRING(ARRAY_AGG(ih.object_name ORDER BY hi.weight), ', ')"; + } else { $parents = "GROUP_CONCAT(ih.object_name ORDER BY hi.weight SEPARATOR ', ')"; + } return array( 'id' => 'h.id', @@ -60,8 +61,9 @@ class IcingaHostTable extends IcingaObjectTable array('ih' => 'icinga_host'), 'hi.parent_host_id = ih.id', array() - )->group('h.id, z.object_name') - ->order('h.object_name'); + )->group('h.id') + ->group('z.id') + ->order('h.object_name'); return $query; }