Congratulations, it's time for the mandatory Postgres issue!
Postgres gives this error:
ERROR: column "n.vid" must appear in the GROUP BY clause or be used in an aggregate function
I researched the problem a little and came up with an answer. The problem is that whenever you use a GROUP BY, all columns you refer to in the SELECT or ORDER BY must also be in the GROUP BY statement (or be used in an aggregate function rather than being referred to directly). The reason for that is that you would otherwise get arbitrary results from the query. Example:
col1 | col2 -----+----- A | 1 A | 2 B | 3
If you do SELECT col2 FROM table GROUP BY col1 there's no telling which value of col2 you'll get (1 or 2).
The fix involves two things:
1. Remove the "*" from the SELECT and only get the fields we need.
2. Include the selected and sorted by fields in the GROUP BY.
The attached patch does this.
(Nice little module by the way! I'll probably just call similarterms_list() from within my theme and have it output some nice links in my node.tpl.php.)
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | similarterms_postgresql.patch | 712 bytes | zoo33 |
Comments
Comment #1
zoo33 commentedDarn... the patch!
Comment #2
jjeff commentedA patch!!! You, my friend are worth your weight in gold.
I'll test this out.
Comment #3
roderikThanks for the patch. (And the module!)
I applied without looking at the original code. The patch does exactly what it should: modify the query into 'sensible' (ANSI standard) SQL, that does work on other databases except MySQL. Feel inclined to set status to 'patch (ready to be committed)' ;)
Comment #4
jjeff commentedcommitted
Comment #5
(not verified) commented