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.

Comments

dave reid’s picture

Status: Active » Fixed

Yep using COUNT(*) is preferred and how core does it. Committed to CVS.
http://drupal.org/cvs?commit=503492

ChrisLaFrancis’s picture

Status: Fixed » Active
StatusFileSize
new1.18 KB

Looks 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.

dave reid’s picture

Status: Active » Fixed

Committed #2 to CVS.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.