#11104: HAVING filter screws with extra() SQL parameter ordering
-----------------------------+----------------------------------------------
 Reporter:  miracle2k        |       Owner:            
   Status:  new              |   Milestone:            
Component:  ORM aggregation  |     Version:  SVN       
 Keywords:                   |       Stage:  Unreviewed
Has_patch:  0                |  
-----------------------------+----------------------------------------------
 {{{
 >>> qs = Model.objects.extra(where=['foo>%s'],
 params=[2]).annotate(count=Count('bar')).filter(bar=99)
 >>> qs.query.as_sql()
 ('SELECT `site_publication`.`id`, ..., FROM ... WHERE foo > %s GROUP BY
 ... HAVING bar > %s',
  (99, 2))
 }}}

 As you can see, the parameters (99 and 2) are in the wrong order. "foo",
 the first filter, should be evaluated against 2, and bar, the second one,
 against 99.

 If "bar" is not an aggregate, it works, because apparently the filter
 would be placed in the WHERE clause *before* the "extra()" where.

 Using rev. 10743.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/11104>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to