Icinga / icingaweb2-module-cube

Drill-down view for Icinga web 2 based on custom variables
GNU General Public License v2.0
45 stars 12 forks source link

PostgreSQL: Error in SQL syntax #46

Closed loukash closed 4 years ago

loukash commented 4 years ago

Describe the bug

SQLSTATE[42803]: Grouping error: 7 ERROR: column "cv.customvariablestatus_id" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: SELECT cv.varname, cv.* FROM icinga_objects AS ho
^, query was: SELECT cv.varname, cv.* FROM icinga_objects AS ho
INNER JOIN icinga_hosts AS h ON h.host_object_id = ho.object_id AND ho.is_active = 1 AND ho.objecttype_id = 1
INNER JOIN icinga_customvariablestatus AS cv ON cv.object_id = ho.object_id WHERE (cv.is_json = 0) GROUP BY cv.varname ORDER BY LOWER(h.display_name) ASC
SQLSTATE[42803]: Grouping error: 7 ERROR: column "cv.customvariablestatus_id" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: SELECT cv.varname, cv.* FROM icinga_objects AS ho
^

To Reproduce

Open Reporting -> Cube

Your Environment

Include as many relevant details about the environment you experienced the problem in

sudo icingacli module list
MODULE         VERSION   STATE     DESCRIPTION
businessprocess 2.2.0     enabled   A Business Process viewer and modeler
cube           1.1.0     enabled   Cube for Icinga Web 2
director       1.7.1     enabled   Director - Config tool for Icinga 2
doc            2.7.3     enabled   Documentation module
grafana        1.3.6     enabled   Grafana - A perfdata visualisation module
incubator      0.5.0     enabled   Incubator provides bleeding-edge libraries
ipl            v0.4.0    enabled   The Icinga PHP library
map            1.0.3     enabled   Map visualization
monitoring     2.7.3     enabled   Icinga monitoring module
reactbundle    0.7.0     enabled   ReactPHP-based 3rd party libraries
reporting      0.9.0     enabled   Reporting
translation    2.7.3     enabled   Translation module
vsphere        1.1.0     enabled   VMware vSphere Import Source
vspheredb      1.0.4     enabled   VMware vSphere DB
x509           1.0.0     enabled   Scan and view X.509 certificate usage

Additional context

#0 /usr/share/icingaweb2/library/vendor/Zend/Db/Statement.php(297): Zend_Db_Statement_Pdo->_execute(Array)
#1 /usr/share/icingaweb2/library/vendor/Zend/Db/Adapter/Abstract.php(470): Zend_Db_Statement->execute(Array)
#2 /usr/share/icingaweb2/library/vendor/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query(String, Array)
#3 /usr/share/icingaweb2/library/vendor/Zend/Db/Adapter/Abstract.php(782): Zend_Db_Adapter_Pdo_Abstract->query(Object(Zend_Db_Select), Array)
#4 /usr/share/icingaweb2/modules/cube/library/Cube/Ido/IdoHostStatusCube.php(72): Zend_Db_Adapter_Abstract->fetchCol(Object(Zend_Db_Select))
#5 /usr/share/icingaweb2/modules/cube/library/Cube/Cube.php(84): Icinga\Module\Cube\Ido\IdoHostStatusCube->listAvailableDimensions()
#6 /usr/share/icingaweb2/modules/cube/application/forms/DimensionsForm.php(29): Icinga\Module\Cube\Cube->listAdditionalDimensions()
#7 /usr/share/icingaweb2/modules/cube/library/Cube/Web/Form/QuickForm.php(312): Icinga\Module\Cube\Forms\DimensionsForm->setup()
#8 /usr/share/icingaweb2/modules/cube/library/Cube/Web/Form/QuickForm.php(451): Icinga\Module\Cube\Web\Form\QuickForm->prepareElements()
#9 /usr/share/icingaweb2/modules/cube/library/Cube/Web/Form/QuickForm.php(464): Icinga\Module\Cube\Web\Form\QuickForm->setRequest(Object(Icinga\Web\Request))
#10 /usr/share/icingaweb2/modules/cube/library/Cube/Web/Form/QuickForm.php(324): Icinga\Module\Cube\Web\Form\QuickForm->getRequest()
#11 /usr/share/icingaweb2/modules/cube/library/Cube/Web/Controller.php(101): Icinga\Module\Cube\Web\Form\QuickForm->handleRequest()
#12 /usr/share/icingaweb2/modules/cube/application/controllers/HostsController.php(15): Icinga\Module\Cube\Web\Controller->renderCube()
#13 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action.php(507): Icinga\Module\Cube\Controllers\HostsController->indexAction()
#14 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Zend_Controller_Action->dispatch(String)
#15 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#16 /usr/share/php/Icinga/Application/Web.php(300): Zend_Controller_Front->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#17 /usr/share/php/Icinga/Application/webrouter.php(99): Icinga\Application\Web->dispatch()
#18 /usr/share/icingaweb2/public/index.php(4): require_once(String)
#19 {main}
#0 /usr/share/icingaweb2/library/vendor/Zend/Db/Statement/Pdo.php(219): PDOStatement->execute(Array)
#1 /usr/share/icingaweb2/library/vendor/Zend/Db/Statement.php(297): Zend_Db_Statement_Pdo->_execute(Array)
#2 /usr/share/icingaweb2/library/vendor/Zend/Db/Adapter/Abstract.php(470): Zend_Db_Statement->execute(Array)
#3 /usr/share/icingaweb2/library/vendor/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query(String, Array)
#4 /usr/share/icingaweb2/library/vendor/Zend/Db/Adapter/Abstract.php(782): Zend_Db_Adapter_Pdo_Abstract->query(Object(Zend_Db_Select), Array)
#5 /usr/share/icingaweb2/modules/cube/library/Cube/Ido/IdoHostStatusCube.php(72): Zend_Db_Adapter_Abstract->fetchCol(Object(Zend_Db_Select))
#6 /usr/share/icingaweb2/modules/cube/library/Cube/Cube.php(84): Icinga\Module\Cube\Ido\IdoHostStatusCube->listAvailableDimensions()
#7 /usr/share/icingaweb2/modules/cube/application/forms/DimensionsForm.php(29): Icinga\Module\Cube\Cube->listAdditionalDimensions()
#8 /usr/share/icingaweb2/modules/cube/library/Cube/Web/Form/QuickForm.php(312): Icinga\Module\Cube\Forms\DimensionsForm->setup()
#9 /usr/share/icingaweb2/modules/cube/library/Cube/Web/Form/QuickForm.php(451): Icinga\Module\Cube\Web\Form\QuickForm->prepareElements()
#10 /usr/share/icingaweb2/modules/cube/library/Cube/Web/Form/QuickForm.php(464): Icinga\Module\Cube\Web\Form\QuickForm->setRequest(Object(Icinga\Web\Request))
#11 /usr/share/icingaweb2/modules/cube/library/Cube/Web/Form/QuickForm.php(324): Icinga\Module\Cube\Web\Form\QuickForm->getRequest()
#12 /usr/share/icingaweb2/modules/cube/library/Cube/Web/Controller.php(101): Icinga\Module\Cube\Web\Form\QuickForm->handleRequest()
#13 /usr/share/icingaweb2/modules/cube/application/controllers/HostsController.php(15): Icinga\Module\Cube\Web\Controller->renderCube()
#14 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action.php(507): Icinga\Module\Cube\Controllers\HostsController->indexAction()
#15 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Zend_Controller_Action->dispatch(String)
#16 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#17 /usr/share/php/Icinga/Application/Web.php(300): Zend_Controller_Front->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#18 /usr/share/php/Icinga/Application/webrouter.php(99): Icinga\Application\Web->dispatch()
#19 /usr/share/icingaweb2/public/index.php(4): require_once(String)
#20 {main}
lippserd commented 4 years ago

Fixed w/ d80a25105aa0092f886fc8031be7a22784b8b087