#11104: HAVING filter screws with extra() SQL parameter ordering --------------------------------------+------------------------------------- Reporter: miracle2k | Owner: Status: new | Milestone: Component: ORM aggregation | Version: SVN Resolution: | Keywords: Stage: Accepted | Has_patch: 0 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | --------------------------------------+------------------------------------- Changes (by russellm):
* needs_better_patch: => 0 * stage: Unreviewed => Accepted * needs_tests: => 0 * needs_docs: => 0 Comment: A related use case, reported in #11117: {{{ Book.objects.extra( select={'date': "DATE_FORMAT(timestamp, '%s')"}, select_params=('%%H',), where=["DATE_FORMAT(timestamp, '%%H:%%i') > '%s'"], params=['22:00']).values('date').annotate(cnt=Count('id')) }}} the resulting sql query is: {{{ SELECT DATE_FORMAT(timestamp, '%H') AS `date`, COUNT(id) AS `cnt` FROM `books` WHERE DATE_FORMAT(timestamp, '%H:%i') > '%H' GROUP BY DATE_FORMAT(timestamp, '22:00') ORDER BY timestamp ASC }}} The placeholder values '%H' and '22:00' are interchanged, which is obviously a result of using the GROUP BY here on a user-defined variable with placeholder (--> 'date') -- Ticket URL: <http://code.djangoproject.com/ticket/11104#comment:1> 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 -~----------~----~----~----~------~----~------~--~---