select missing "group by" column in postgres query
rbroberts - April 25, 2006 - 17:08
| Project: | Drupal |
| Version: | 4.7.0-rc3 |
| Component: | postgresql database |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | duplicate |
Jump to:
Description
I'm a newbie with Drupal (4.7RC3) but have been using php and postgres for a long time. My first page creation gave me this:
* warning: pg_query() [function.pg-query]: Query failed: ERROR: column "c.status" must appear in the GROUP BY clause or be used in an aggregate function in /var/www/cms.astrofoto.org/html/includes/database.pgsql.inc on line 84.
* user warning: query: SELECT c.cid as cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, c.homepage, u.uid, u.name AS registered_name, u.picture, u.data, c.score, c.users, c.thread, c.status FROM comments c INNER JOIN users u ON c.uid = u.uid WHERE c.nid = 1 GROUP BY c.cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, u.picture, c.homepage, u.uid, u.name, u.picture, u.data, c.score, c.users, c.thread ORDER BY c.thread DESC LIMIT 50 OFFSET 0 in /var/www/cms.astrofoto.org/html/includes/database.pgsql.inc on line 103.The error appears to be in modules/comment.module at line 755 which, as the error says, just needs c.status added to the group by clause.

#1
Re-assigning this to the proper place -- it's unrelated to the dba.module which it was originally assigned to.
#2
Fixed by this:
http://drupal.org/node/58921
Here's the diff.