After updating to the latest dev release, I noticed the following error messages in the log after cron ran:
pg_query(): Query failed: ERROR: column "users.uid" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: ...T(*) FROM users WHERE status = 1 AND uid >= 228 ORDER BY uid
^ in
<path_to_drupal>/includes/database.pgsql.inc on line 139.query: SELECT COUNT(*) FROM users WHERE status = 1 AND uid >= 228 ORDER BY uid in <path_to_drupal>/sites/all/modules/realname/realname.module on line 706.
Basically, PostgreSQL (8.4.7) doesn't like the fact that uid is specified in the ORDER BY.
As far as I can tell, it doesn't really matter what order the rows come back in (as it's just getting a count of the rows returned), so I think that ORDER BY can be eliminated.
Also, instead of doing a COUNT(uid), I think a COUNT(*) would be more correct.
I've attached a patch that makes those changes.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | realname-count_with_order_by.patch | 1.18 KB | ChrisLaFrancis |
| realname-count_syntax.patch | 1.27 KB | ChrisLaFrancis |
Comments
Comment #1
dave reidYep using COUNT(*) is preferred and how core does it. Committed to CVS.
http://drupal.org/cvs?commit=503492
Comment #2
ChrisLaFrancis commentedLooks like what was committed to CVS did change the COUNT() functions and got rid of one of the ORDER BY clauses, but there are still two COUNT()'s with ORDER BY's in the latest dev release which PostgreSQL is complaining about. Attached is another patch.
Comment #3
dave reidCommitted #2 to CVS.