PostgreSQL patch

JeniferTucker - June 12, 2008 - 15:34
Project:Site map
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:duplicate
Description

* warning: pg_query() [function.pg-query]: Query failed: ERROR: column "u.uid" must appear in the GROUP BY clause or be used in an aggregate function in /usr/share/drupal/includes/database.pgsql.inc on line 125.
* user warning: query: SELECT DISTINCT u.uid, u.name, count(u.uid) AS numitems FROM node n INNER JOIN users u ON u.uid = n.uid WHERE n.type = 'blog' and n.status = 1 GROUP BY n.uid ORDER BY numitems DESC, u.name LIMIT 10 OFFSET 0 in /usr/share/drupal/includes/database.pgsql.inc on line 144.

... the simple fix for this in postgreSQL I believe is:

change:

GROUP BY n.uid

to:

GROUP BY u.uid, u.name, n.uid

results:

uid | name | numitems
-----+----------------+----------
3 | Harry Potter | 21
4 | Albus Dumbledore | 5
5 | Hermione Granger | 4
16 | Cho Chang | 4
11 | Sirius Black | 3
17 | Bathilda Bagshot | 2
13 | Cedric Diggory | 2
22 | Dudley Dursley | 2
20 | Neville Longbottom | 1
25 | Luna Lovegood | 1
(10 rows)

Thanks

#1

miche - April 30, 2009 - 19:47

+1 (but I am using 6.x-1.0)

#2

frjo - May 1, 2009 - 06:50
Version:5.x-1.2» 6.x-1.x-dev

If you have time I would appreciate if you could try out the 6-dev version. I have rebuilt this part of the code there.

#3

kiamlaluno - May 11, 2009 - 16:45
Title:PostgreSQl patch please» PostgreSQL patch

#4

Dave Reid - July 1, 2009 - 13:22
Status:active» duplicate

Marking this as a duplicate of #455840: PostgreSQL: invalid GROUP BY with use of DISTINCT since there is a patch posted there.

 
 

Drupal is a registered trademark of Dries Buytaert.