SELECT count(n.nid) FROM node n INNER JOIN acidfree on n.nid = acidfree.aid INNER JOIN acidfree_hierarchy ON acidfree_hierarchy.child = acidfree.aid WHERE parent = 5 ORDER BY weight ASC, aid DESC in /usr/share/drupal/includes/database.pgsql.inc on line 62.
message from postgresql
Query failed: ERROR: column "acidfree.weight" must appear in the GROUP BY clause or be used in an aggregate function in /usr/share/drupal/includes/database.pgsql.inc on line 45.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | acidfree.module_1.patch | 3.19 KB | JamieR |
Comments
Comment #1
vhmauery commenteddoes a query more like
help any? I don't have a postgress server to test this on and am not a real SQL guru (I know enough to get myself in trouble, obviously).
Comment #2
crszczub commentedI don't suppose you ever got this working? I attempted to use PostgreSQL 8 and 7 with Acidfree 4.7.0 on Drupal 4.7.2 and produced the same error. I did try to edit the acidfree.module file and add the GROUP BY clause into the particular query which did make the error go away, but ran into a significant number of errors when trying to actually post a photo.
Comment #3
ghostbar commentedvhmauery where should i put that query of the sql?...
Comment #4
iolaus commentedThe problem stems from appending the return of _acidfree_content_sort_clause() to a query using COUNT(). There is no reason to sort the results of a query when simply counting the number of rows (and in fact postgresql will not allow it without an aggregate function on the sort column). The problem can be solved by finding all queries that use COUNT() and removing the _acidfree_content_sort_clause() value appended to them.
Comment #5
vhmauery commentedIn some cases, it is not possible to just remove the _acidfree_content_sort_clause(). Sometimes the count we want is the offset into the parent album, which means, we need to have a count of the sorted order of a selection from the parent album. What I need help on is to tell me where to put the 'group by' clause. It doesn't complain with mysql and I don't have a postgres server to play with. So does the above query work? (hint, you might have to change the parent=5 clause to something else (5 was the nid of an album from the original report, so just replace 5 with any album id))
Or, tell me how to rewrite the statement above to make it work right.
Comment #6
havran commentedHi, i have PostgreSQL 7.4 on my web server. I have modiffied this query:
and now query work without errors.
I use CVS version Acidfree /* $Id: acidfree.module,v 1.91 2006/07/07 20:08:10 vhmauery Exp $ */ on Drupal 4.7.3
This maybe need test with MySQL.
Comment #7
havran commentedOk, query works without errors but return bad number :). I don't have better solution, only this -> node/78752. Now seems all in Acidfree module working correct. In this node/78749 i made minor changes for filemanager.module (corresponding with acidfree).
Comment #8
JamieR commentedhavran - thank you for the info - I was just removing the order by clause. I've attached a patch even though you say it isn't returning the correct number at this point it's better than nothing. Also are you having any problems with the following error, or was it addressed in one of your other patches? Thanks for the help... I wish postgreSQL was better supported. To those MySQL guys - it's REALLY easy to install and test! ;)
Here is the error I'm still getting on the edit pages:
I'm having problems with this coding convention all over the place... here for example: http://drupal.org/node/78612
It seems like since MySQL is more flexible about working with strange code, that we all should be coding for postgreSQL first.
Thanks!
Comment #9
havran commentedFinnaly this is better way (in function _acidfree_get_children()):
I move _acidfree_content_sort_clause() function from $clauses in to db_rewrite_sql().
Comment #10
vhmauery commentedThanks for the push. I finally had to install my own postgres server so I could test it out myself. I came up with a simpler solution, which, might even fix mysql 3.x installations as well. The fix is in DRUPAL-4-7 branch of CVS, so check it out or wait a while until it gets repackaged (version 1.62.2.42)
Comment #11
vhmauery commented