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

CommentFileSizeAuthor
#2 pgsql_messages_groupby.patch918 bytesberdir

Comments

berdir’s picture

Strange, 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.

berdir’s picture

Priority: Normal » Critical
Status: Active » Needs review
StatusFileSize
new918 bytes

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

berdir’s picture

Version: 6.x-1.1 » 7.x-1.x-dev
Status: Needs review » Patch (to be ported)

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

tsaks’s picture

Version: 7.x-1.x-dev » 6.x-1.1

I 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

berdir’s picture

Version: 6.x-1.1 » 7.x-1.x-dev

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

berdir’s picture

Status: Patch (to be ported) » Fixed

This has been fixed in 7.x-1.x-dev too, together with anoher bug.

Status: Fixed » Closed (fixed)

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