I have the following issue:
When a user tries to create a new topic in og forum then the followings errors appears:
1) warning: pg_query() [function.pg-query]: Query failed: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list at character 276 in /var/www/sibportals2.icstweb.eu/includes/database.pgsql.inc on line 139.
2) user warning: query: SELECT DISTINCT t.* FROM term_node r INNER JOIN term_data t ON r.tid = t.tid INNER JOIN vocabulary v ON t.vid = v.vid LEFT JOIN og_term ogt ON ogt.tid = t.tid WHERE (ogt.public > 1 OR ogt.nid IN (166,16,164,20,6,24,22,28,75,72) AND t.tid != -1) AND ( r.vid = 148 )ORDER BY v.weight, t.weight, t.name in /var/www/sibportals2.icstweb.eu/modules/taxonomy/taxonomy.module on line 632.
Also when a user of a group tries to create a topic in a specific group then the following errors occurs:
warning: pg_query() [function.pg-query]: Query failed: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list at character 229 in /var/www/sibportals2.icstweb.eu/includes/database.pgsql.inc on line 139.
user warning: query: SELECT DISTINCT t.* FROM term_node r INNER JOIN term_data t ON r.tid = t.tid INNER JOIN vocabulary v ON t.vid = v.vid LEFT JOIN og_term ogt ON ogt.tid = t.tid WHERE (ogt.public > 1 AND t.tid != -1) AND ( r.vid = 170 )ORDER BY v.weight, t.weight, t.name in /var/www/sibportals2.icstweb.eu/modules/taxonomy/taxonomy.module on line 632.
warning: pg_query() [function.pg-query]: Query failed: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list at character 255 in /var/www/sibportals2.icstweb.eu/includes/database.pgsql.inc on line 139.
user warning: query: SELECT DISTINCT t.* FROM term_node r INNER JOIN term_data t ON r.tid = t.tid INNER JOIN vocabulary v ON t.vid = v.vid LEFT JOIN og_term ogt ON ogt.tid = t.tid WHERE (ogt.public > 1 OR ogt.nid IN (166,16,20) AND t.tid != -1) AND ( r.vid = 171 )ORDER BY v.weight, t.weight, t.name in /var/www/sibportals2.icstweb.eu/modules/taxonomy/taxonomy.module on line 632.
warning: pg_query() [function.pg-query]: Query failed: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list at character 255 in /var/www/sibportals2.icstweb.eu/includes/database.pgsql.inc on line 139.
user warning: query: SELECT DISTINCT t.* FROM term_node r INNER JOIN term_data t ON r.tid = t.tid INNER JOIN vocabulary v ON t.vid = v.vid LEFT JOIN og_term ogt ON ogt.tid = t.tid WHERE (ogt.public > 1 OR ogt.nid IN (166,16,20) AND t.tid != -1) AND ( r.vid = 294 )ORDER BY v.weight, t.weight, t.name in /var/www/sibportals2.icstweb.eu/modules/taxonomy/taxonomy.module on line 632.
I would be really grateful if someone could give me a hand..
Comments
Comment #1
-Mania- commentedI am getting errors as well, looks to be postgres related? I'm using the latest dev because the 2.2 stable version doesn't work for me (due to http://drupal.org/node/651672).
Creating a topic:
Viewing a forum:
Comment #2
thepanz commentedThis issue seems to be related to PostGRESQL engine.
Could you please further investigate in which part of the QUERY is causing the issue? AFAIK this could be related to a different syntax between MySQL and Postgres
Cheers
Comment #3
salvisCiting from http://www.postgresql.org/docs/8.2/static/sql-select.html
You have to put the JOIN condition into the ON clause, such as
Whenever you don't know how to do something, then look into the core or contrib code. In this case search for "INNER JOIN" to find plenty of examples of how to write inner joins.
Comment #4
markshep commentedTo get rid of this error:
I just changed the SQL query on line 632 of that file from
SELECT t.* FROM {term_node}... toSELECT t.*, v.weight FROM {term_node}.... Hopefully that won't have any bad effects!Comment #5
vegantriathlete