When enabling AdvAgg and all of the sub modules but CDN I get the following database error in postgreSQL.
PDOException: SQLSTATE[42803]: Grouping error: 7 ERROR: column "aav.aggregate_filenames_hash" must appear in the GROUP BY clause or be used in an aggregate function LINE 4: INNER JOIN (SELECT aav.aggregate_filenames_hash AS aggregate... ^: SELECT af.filename AS filename, af.filesize AS filesize, af.mtime AS mtime, af.changes AS changes, af.linecount AS linecount, aa.counter AS counter, aa.aggregate_filenames_hash AS aggregate_filenames_hash, aa.porder AS aaporder FROM {advagg_files} af INNER JOIN (SELECT aav.aggregate_filenames_hash AS aggregate_filenames_hash, aa.filename_hash AS filename_hash, aa.porder AS porder, LPAD(CAST(COUNT(aav.aggregate_filenames_hash) AS char(8)), 8, '0') AS counter FROM {advagg_aggregates} aa INNER JOIN (SELECT aav.* FROM {advagg_aggregates_versions} aav WHERE (aav.root = :db_condition_placeholder_0) AND (aav.atime > :db_condition_placeholder_1) ) aav ON aav.aggregate_filenames_hash=aa.aggregate_filenames_hash GROUP BY aa.filename_hash) aa ON af.filename_hash=aa.filename_hash ORDER BY aa.counter DESC, aa.aggregate_filenames_hash ASC, aa.porder ASC; Array ( [:db_condition_placeholder_0] => 1 [:db_condition_placeholder_1] => 1374686780 ) in advagg_bundler_analysis() (line 190 of /mnt/www/html/wet-boew-drupal/sites/all/modules/advagg/advagg_bundler/advagg_bundler.module).
Comments
Comment #1
sylus commentedMaking title more descriptive.
This stack overflow article seems to highlight the issue: http://stackoverflow.com/questions/1062158/converting-mysql-select-to-po...
Comment #2
mikeytown2 commentedI'm using db_select so that should take care of PostgreSQL issues correct; is this a PDO bug? The code in question involves multiple sub queries
http://drupalcode.org/project/advagg.git/blob/7769bca529e9f780ff8c5d773e...
Comment #3
mikeytown2 commentedComment #4
mikeytown2 commentedAdding in
->groupBy('aav.aggregate_filenames_hash')makes the query take 2.5 times as long to run on MySQL (10ms to 25ms, so something to be aware of).Background issues #2006468: Slow Query in advagg_bundler_analysis. Run query in the background (via httprl) if at all possible. #1927578-9: Get end to end prototype working
Comment #5
mikeytown2 commentedComment #6
sylus commentedHey mikeytown2 thanks so much for taking a look at this.
I applied your patch and got the following error:
Modifying your patch slightly I got the everything to work again:
Not sure why PostgreSQL enforces that the columns have to be contained in an aggregate or group by function though.
Comment #7
mikeytown2 commentedabove patch isn't going to work. changes the output of the bundler. Will look into using the non-optimized version and see if I can get that to fly with this constraint in mind http://dev.mysql.com/doc/refman/5.6/en/group-by-extensions.html
Comment #8
sylus commentedThanks so much for taking a look at this. Also your right about the patch not working with bundler but at least am able to play around now :)
Comment #9
mikeytown2 commentedCan you test this patch out? It should do the trick :)
Comment #10
sylus commentedBased on an initial eval works great :) Really appreciate it!
Comment #11
mikeytown2 commentedPatch in #9 has been committed. Thanks for testing the patch :)