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

    Details

    • Type: Incident report
    • Status: Reopened
    • Priority: Trivial
    • Resolution: Unresolved
    • Affects Version/s: 3.0.0alpha2
    • Fix Version/s: None
    • Component/s: API (A)
    • Labels:

      Description

      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 ^]

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated: