Error on OG Pages ... "SELECT DISTINCT(u.uid), u.* FROM og_uid ogu INNER JOIN users ..."

WISEOZ - January 22, 2008 - 02:41
Project:Organic groups
Version:HEAD
Component:og.module
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

I receive the following areas on my OG home pages:

    * warning: pg_query() [function.pg-query]: Query failed: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list in /usr/local/apache2/htdocs/drupal/includes/database.pgsql.inc on line 125.
    * user warning: query: SELECT DISTINCT(u.uid), u.* FROM og_uid ogu INNER JOIN users u ON ogu.uid = u.uid WHERE ogu.nid = 37 AND ogu.is_active = 1 AND u.status = 1 ORDER BY ogu.created DESC LIMIT 10 OFFSET 0 in /usr/local/apache2/htdocs/drupal/includes/database.pgsql.inc on line 144.

I am on Drupal 5.5 with PostgreSQL.

#1

moshe weitzman - January 25, 2008 - 15:21
Status:active» active (needs more info)

can you add ogu.created to the first part of that query (the "fields" section) and see if it fixes the error? i am not currently testing with pg.

#2

WISEOZ - February 4, 2008 - 02:02

Moshe, I'd love to give this a try but can you be more specific as to what I should change. I'm not the certain where or exactly what you're suggesting I change. Thanks!

#3

najibx - March 22, 2008 - 13:08
Version:5.x-5.0» HEAD

Hi WISEOZ,

I think what Moshe was referring is to adding "created" field in "ogu" table. look at your table structure via PHPmyadmin or something ...

SELECT DISTINCT(u.uid), u.* FROM og_uid ogu ...
if we look at the SELECT command, there must be a table "og_uid" & "ogu". If either of this table, or some field not exist, causes this error.

I have similar problem ... in my case I don't have table named "ogu" and I have upgrade even into HEAD version.
How come? Do I have to manually create it? What are the fields?

#4

WISEOZ - March 22, 2008 - 13:13

I had a friend figure this out for me but I have no idea what they did. I am no longer receiving this error.

#5

jaydub - April 13, 2008 - 07:25
Status:active (needs more info)» patch (code needs review)

Here is my patch for the SQL in question. As for the people reporting that
they don't have a {og_uid} table that is a bigger problem.

The og.install itself is not setup correctly for PostgreSQL as it currently uses
numeric column types instead of integer and smallint columns. See the
patch here http://drupal.org/node/226336

#6

mikeryan - April 14, 2008 - 19:55

I've hit this as well with a project using OG with PostgreSQL. It looks like you forgot to attach the patch, could you add it?

Thanks.

#7

jaydub - April 15, 2008 - 00:33

yep forgot to attach patch

AttachmentSize
og.module.212771.patch925 bytes

#8

moshe weitzman - April 15, 2008 - 01:24
Status:patch (code needs review)» fixed

committed. thx.

#9

Anonymous (not verified) - April 29, 2008 - 01:32
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.