Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-9953

API "get" calls with incompatible "countOutput" and "sortfield" options causes SQL errors

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • None
    • 3.0.0alpha2
    • API (A)

      API::Item()->get([
          'countOutput' => true,
          'sortfield' => ['itemid']
      ]);
      

      pg_query(): Query failed: ERROR: column "i.itemid" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: ...ems i WHERE i.type<>9 AND i.flags IN (0,4) ORDER BY i.itemid ^ [hosts.php:117 ? CFrontendApiWrapper->get() ? CApiWrapper->__call() ? CFrontendApiWrapper->callMethod() ? CApiWrapper->callMethod() ? CFrontendApiWrapper->callClientMethod() ? CLocalApiClient->callMethod() ? call_user_func_array() ? CItem->get() ? DBselect() ? pg_query() in include/db.inc.php:395]
      Error in query [SELECT COUNT(DISTINCT i.itemid) AS rowscount FROM items i WHERE i.type<>9 AND i.flags IN (0,4) ORDER BY i.itemid] [ERROR: column "i.itemid" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: ...ems i WHERE i.type<>9 AND i.flags IN (0,4) ORDER BY i.itemid ^]

            Unassigned Unassigned
            sasha Alexander Vladishev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: