System:
------------
PHP 4.4.1
Apache 1.3.34
Drupal CVS-HEAD
Postgresql 8.0.4
Problem:
-------------
When I choose "top visitors" in the administration-->registers menu, I get this error:
--------------------------------------------------------------------------------------------
/?q=admin/logs/visitors
pg_query(): Query failed: ERROR: column "a.uid" must appear in the GROUP BY clause or be used in an aggregate function en la línea 78 del archivo /home/erl/drupal-cvs/includes/database.pgsql.inc.
/?q=admin/logs/visitors
query: SELECT COUNT(a.uid) AS hits, a.uid, u.name, a.hostname, SUM(a.timer) AS total, ac.aid FROM accesslog a LEFT JOIN access ac ON ac.type = 'host' AND LOWER(a.hostname) LIKE (ac.mask) LEFT JOIN users u ON a.uid = u.uid GROUP BY a.hostname ORDER BY hits DESC LIMIT 30 OFFSET 0 en la línea 95 del archivo /home/erl/drupal-cvs/includes/database.pgsql.inc.
--------------------------------------------------------------------------------------------
This error makes impossible to get these statistics if you are using postgresql as the database. Thanks for your time.
Comment | File | Size | Author |
---|---|---|---|
#1 | drupal-head-statistics-36937_0.diff | 1.13 KB | Cvbge |
Comments
Comment #1
Cvbge CreditAttribution: Cvbge commentedHi,
thank you for your report.
As error suggest for postgres some other fields (namely a.uid, u.name, ac.aid) need to be added to GROUP BY clause.
Mysql in this case gets a random value for fields that are not in group by - treats them as unique in the group. From http://dev.mysql.com/doc/refman/4.1/en/group-by-hidden-fields.html
Attached patch adds the fields to the group by clause.
Comment #2
ralfm CreditAttribution: ralfm commentedThanks, I applied this patch and everything works ok now ....... cvs can be updated
Comment #3
Steven CreditAttribution: Steven commentedCommitted to HEAD, thanks.
Comment #4
(not verified) CreditAttribution: commented