Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
og.pages_.inc_.patch | 598 bytes | davidwhthomas | |
Comments
Comment #1
davidwhthomas CreditAttribution: davidwhthomas commentedComment #2
moshe weitzman CreditAttribution: moshe weitzman commentedCommitted. Thx.