src/Baum/Extensions/Query/Builder.php
public function aggregate($function, $columns = array('*')) {
    // Postgres doesn't like ORDER BY when there's no GROUP BY clause
    if ( !isset($this->groups) )
      $this->reOrderBy(null);

    return parent::aggregate($function, $columns);
  }
public function aggregate($function, $columns = array('*')) {
    // Postgres doesn't like ORDER BY when there's no GROUP BY clause
    if ( !isset($this->groups) )
      $this->reOrderBy(null);

    return parent::aggregate($function, $columns);
  }
Execute an aggregate function on the database.

@param  string  $function
@param  array   $columns
@return mixed