ExportXMLWordPrintable

    • Type: Incident report
    • Resolution: Unresolved
    • Priority: Trivial
    • None
    • Affects Version/s: 7.0.32, 7.4.16, 8.0.0rc3
    • Component/s: Frontend (F)
    • None

      The SVG graph widget fails with a PHP error (SQL syntax error) on PostgreSQL when the time period starts close to 1970-01-01.

      Steps to reproduce:

      1. Add an SVG graph widget to a dashboard.
      2. Set in filter time period to custom: From 1970-01-02 00:00:00, To 1971-01-01 00:00:00 and save.
      3. Check the widget and the PHP error log.

      Actual Result:
      The graph shows no data. The widget and the PHP error log both show the following error:

      pg_query(): Query failed: ERROR:  syntax error at end of input
      LINE 1: ...id,round(744.0*(clock--260860)/32122520,0) ORDER BY itemid,i
                                                                             ^ [zabbix.php:17 -> require_once() -> ZBase->run() -> ZBase->processRequest() -> CController->run() -> Widgets\SvgGraph\Actions\WidgetView->doAction() -> Widgets\SvgGraph\Includes\CSvgGraphHelper::get() -> Widgets\SvgGraph\Includes\CSvgGraphHelper::getMetricsData() -> CHistoryManager->getGraphAggregationByWidth() -> CHistoryManager->getGraphAggregationByWidthFromSql() -> DBselect() -> pg_query() -> CConfigFile->{closure:/home/zabbix/workspace/7.0/ui/conf/zabbix.conf.php:83}() in include/db.inc.php:249]
      Error in query [SELECT itemid,SUM(num) AS count,AVG(value_avg) AS avg,MIN(value_min) AS min,MAX(value_max) AS max,round(744.0*(clock--260860)/32122520,0) AS i,MAX(clock) AS clock FROM trends_uint WHERE itemid='42243' AND clock>='-260860' AND clock<='31861660' GROUP BY itemid,round(744.0*(clock--260860)/32122520,0) ORDER BY itemid,i] [ERROR:  syntax error at end of input
      LINE 1: ...id,round(744.0*(clock--260860)/32122520,0) ORDER BY itemid,i
                                                                             ^] [zabbix.php:17 -> require_once() -> ZBase->run() -> ZBase->processRequest() -> CController->run() -> Widgets\SvgGraph\Actions\WidgetView->doAction() -> Widgets\SvgGraph\Includes\CSvgGraphHelper::get() -> Widgets\SvgGraph\Includes\CSvgGraphHelper::getMetricsData() -> CHistoryManager->getGraphAggregationByWidth() -> CHistoryManager->getGraphAggregationByWidthFromSql() -> DBselect() -> trigger_error() -> CConfigFile->{closure:/home/zabbix/workspace/7.0/ui/conf/zabbix.conf.php:83}() in include/db.inc.php:250]
      pg_query(): Query failed: ERROR:  syntax error at end of input
      LINE 1: ...id,round(744.0*(clock--260860)/32122520,0) ORDER BY itemid,i
                                                                             ^ [zabbix.php:17 -> require_once() -> ZBase->run() -> ZBase->processRequest() -> CController->run() -> Widgets\SvgGraph\Actions\WidgetView->doAction() -> Widgets\SvgGraph\Includes\CSvgGraphHelper::get() -> Widgets\SvgGraph\Includes\CSvgGraphHelper::getMetricsData() -> CHistoryManager->getGraphAggregationByWidth() -> CHistoryManager->getGraphAggregationByWidthFromSql() -> DBselect() -> pg_query() -> CConfigFile->{closure:/home/zabbix/workspace/7.0/ui/conf/zabbix.conf.php:83}() in include/db.inc.php:249]
      Error in query [SELECT itemid,SUM(num) AS count,AVG(value_avg) AS avg,MIN(value_min) AS min,MAX(value_max) AS max,round(744.0*(clock--260860)/32122520,0) AS i,MAX(clock) AS clock FROM trends WHERE itemid='42244' AND clock>='-260860' AND clock<='31861660' GROUP BY itemid,round(744.0*(clock--260860)/32122520,0) ORDER BY itemid,i] [ERROR:  syntax error at end of input
      LINE 1: ...id,round(744.0*(clock--260860)/32122520,0) ORDER BY itemid,i
                                                                             ^] [zabbix.php:17 -> require_once() -> ZBase->run() -> ZBase->processRequest() -> CController->run() -> Widgets\SvgGraph\Actions\WidgetView->doAction() -> Widgets\SvgGraph\Includes\CSvgGraphHelper::get() -> Widgets\SvgGraph\Includes\CSvgGraphHelper::getMetricsData() -> CHistoryManager->getGraphAggregationByWidth() -> CHistoryManager->getGraphAggregationByWidthFromSql() -> DBselect() -> trigger_error() -> CConfigFile->{closure:/home/zabbix/workspace/7.0/ui/conf/zabbix.conf.php:83}() in include/db.inc.php:250]
      



      Expected Result:
      The graph is displayed without errors.

        1. image-2026-11-02-15-52-07-417.png
          163 kB
          Rostislavs Belovs
        2. Recording 2026-11-02 at 14.31.37.gif
          1.07 MB
          Rostislavs Belovs

            Assignee:
            Zabbix Development Team
            Reporter:
            Rostislavs Belovs
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: