Ad Widget

Collapse

Graph screen: SQL error when selecting...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Calimero
    Senior Member
    • Nov 2006
    • 481

    #1

    Graph screen: SQL error when selecting...

    Graph: all and Host: all

    I get the following MySQL error:
    Code:
    Error in query [select distinct g.* from graphs g left join graphs_items gi on g.graphid=gi.graphid left join items i on gi.itemid=i.itemid while (g.graphid div 100000000000000) in (0) and ( i.hostid not in (-1) OR i.hostid is NULL ) order by g.name, g.graphid] [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'while (g.graphid div 100000000000000) in (0) and ( i.hostid no] 
    mysql_fetch_array(): supplied argument is not a valid MySQL result resource[/wrk1/htdocs/zabbix/include/db.inc.php:411]
    I guess this is a typo: "WHILE" instead of "WHERE".

    The problem lies in frontends/php/graphs.php:
    Code:
    # diff -u graphs.php.1.4.2 graphs.php.fixed
    --- graphs.php.1.4.2    2007-08-27 12:59:53.000000000 +0200
    +++ graphs.php.fixed    2007-08-27 13:01:39.000000000 +0200
    @@ -345,7 +345,7 @@
                    {
                            $result = DBselect("select distinct g.* from graphs g left join graphs_items gi on g.graphid=gi.graphid ".
                                    " left join items i on gi.itemid=i.itemid ".
    -                               ' while '.DBin_node('g.graphid').
    +                               ' where '.DBin_node('g.graphid').
                                    " and ( i.hostid not in (".$denyed_hosts.")  OR i.hostid is NULL )".
                                    " order by g.name, g.graphid");
                    }
    Once corrected it seems OK (I haven't performed extensive tests though).

    Sorry if it has already been reported and fixed: a quick check on the forum didn't return anything that close and I can't access the SVN repository to check the source.

    Bye !
  • Alexei
    Founder, CEO
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2004
    • 5654

    #2
    Thanks for this! It was already reported and fixed in the latest code.
    Alexei Vladishev
    Creator of Zabbix, Product manager
    New York | Tokyo | Riga
    My Twitter

    Comment

    • FrankTM
      Junior Member
      • Jun 2007
      • 10

      #3
      thanks a lot...
      fixed this issue for me

      Comment

      Working...