this happens when trying to view a private message:
warning: pg_query() [function.pg-query]: Query failed: ERROR: column "pm.timestamp" must appear in the GROUP BY clause or be used in an aggregate function in /home4/maxhoard/public_html/pages/includes/database.pgsql.inc on line 139.
user warning: query: SELECT pmi.mid FROM pm_index pmi INNER JOIN pm_message pm ON (pm.mid = pmi.mid) WHERE (pmi.thread_id IN (1)) AND (pmi.uid = 1) AND (pmi.deleted = 0) GROUP BY pmi.mid ORDER BY pm.timestamp ASC, pm.mid ASC LIMIT 20 OFFSET 0 in /home4/maxhoard/public_html/pages/modules/privatemsg/privatemsg.module on line 359.
If you make the following changes in privatemsg.module, it is fixed for postgres:
On line 1261 change:
$fragments['order_by'][] = 'pm.mid ASC';
to
$fragments['order_by'][] = 'pmi.mid ASC';
Then on line 1258 add:
$fragments['group_by'][] = 'pm.timestamp';
I have only tested this in postgres 8.1
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | pgsql_messages_groupby.patch | 918 bytes | berdir |
Comments
Comment #1
berdirStrange, I thought that I've tested that. Thanks for reporting, can you please create a patch for your suggested changes? See http://drupal.org/patch/create. If you do, I can give you proper credit in the cvs commit message.
Comment #2
berdirThe attached patch should solve the issue, the tests pass again. Will commit this soon against all branches.
There are still 3 fails in the tests with this patch regarding deleting message but I can't figure out why nor reproduce it so let's fix this first.
Comment #3
berdirFixed in 6.x-1.x and 6.x-2.x.
It seems that the group by is missing in 7.x-1.x, I need to figure out why.
Comment #4
tsaks commentedI have the same error described in the initial issue report by ablevine1 when trying to view messages.
I am using 6.x-1.1
Problem is I'm not much of a programmer...how do I apply that patch (pgsql_messages_groupby.patch)
to fix the problem?
Thanks
Comment #5
berdirYou can use one of the 6.x dev releases, both of them contain the patch already. 6.x-1.x-dev is just 6.x-1.1 with this patch while 6.x-2.x-dev contains new features too.
Comment #6
berdirThis has been fixed in 7.x-1.x-dev too, together with anoher bug.