Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
database system
Priority:
Major
Category:
Bug report
Assigned:
Issue tags:
Reporter:
Created:
23 Aug 2011 at 22:30 UTC
Updated:
4 Jan 2014 at 01:11 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
chx commentedTest, fails.
Comment #2
bfroehle commentedIs this sort of approach what we are looking for?
Comment #3
chx commentedThanks for jumping on the issue so quick!
HAVING foo = 1 AND ( bar = 1 OR bar > 3)will break (Edit: for bar). I think you need to refactor the having handling to collect fields. Edit: and even that might not be enough because if you have several levels of DatabaseConditions then havingCondition will only see the top ones. :/Comment #4
chx commentedI needed to merge #1196292: Allow Pager count queries to utilise GROUP BY into this one to make the test pass. We dont remove any expression if there is HAVING.
Comment #5
damien tournoud commentedI am not sure the original query is valid in the first place. In strict SQL, WHERE and GROUP BY can only contain references to columns, not to aliases. It is likely the case for HAVING too.
Comment #6
chx commentedSure. The having methods fixes are still valid even if the countQuery isn't.
Comment #7
chx commentedI studied http://www.postgresql.org/docs/8.1/static/tutorial-agg.html and http://www.postgresql.org/docs/9.0/static/sql-select.html#SQL-HAVING and I think that you can run HAVING on an expression provided the column (or the expression itself?? MySQL and PostgreSQL seems to disagree on that) is selected.
Comment #8
xjmTracking.
Comment #9
catchTagging for backport.
Comment #10
xjmRerolled for
core/.Comment #13
Crell commentedLooking at the patch itself, it's a major "duh". :-) (chx talked to me about this a while back; it just fell off my radar.)
Comment #14
catchLooks great, don't see anything to complain about. Committed to 8.x, moving back to 7.x for which this will need a re-roll.
Comment #15
xjmNothing particular to D8 so it's a straight reroll.
Comment #16
dries commentedCommitted to 7.x. Thanks!
Comment #17
aspilicious commented:)
Comment #18.0
(not verified) commentedchanged to #1054168-2 instead of #1054168:2