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
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
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
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
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
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
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
yep forgot to attach patch
#8
committed. thx.
#9
Automatically closed -- issue fixed for two weeks with no activity.