I received the following error when sorting by the 'Age' table column header on the 'Group Activity' tab

warning: pg_query() [function.pg-query]:
Query failed: ERROR: column "node_group_nid.created"
must appear in the GROUP BY clause
or be used in an aggregate function in /.../includes/database.pgsql.inc on line 139.

user warning: query:
SELECT oga.group_nid, node_group_nid.title, node_group_nid.uid, u.name, COUNT(*) as ncount, MAX(n.created) as ncreated, SUM(ncs.comment_count) as ccount, MAX(last_comment_timestamp) AS lct
FROM node n
INNER JOIN og_ancestry oga
ON n.nid = oga.nid
LEFT JOIN node_comment_statistics ncs
ON n.nid = ncs.nid
INNER JOIN node node_group_nid
ON oga.group_nid = node_group_nid.nid
INNER JOIN users u
ON node_group_nid.uid = u.uid
WHERE n.status = 1
GROUP BY oga.group_nid, node_group_nid.title, node_group_nid.uid, u.name
ORDER BY node_group_nid.created DESC
in /.../sites/all/modules/og/og.pages.inc on line 436.

I found a simple fix was changing og.pages.inc line 433

array('data' => t('Age'), 'field' => 'node_group_nid.created'),

to

array('data' => t('Age'), 'field' => 'ncreated'),

I could then sort normally by the 'Age' table header with no error.

Patch attached

DT

CommentFileSizeAuthor
og.pages_.inc_.patch598 bytesdavidwhthomas
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

davidwhthomas’s picture

Status: Active » Needs review
moshe weitzman’s picture

Status: Needs review » Fixed

Committed. Thx.

Status: Fixed » Closed (fixed)

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