﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
29118	QuerySet.order_by(Exists(...)) crashes	Raphael Gaschignard	nobody	"In {{{BaseExpression}}} we have the following:


{{{
    def resolve_expression(self, query=None, allow_joins=True, reuse=None, summarize=False, for_save=False):
          ...
}}}

Here we have a couple default arguments. A decent number of callsites for this method only provide positional arguments. The {{{Exists}}} subclass assumes keyword-only arguments:

{{{
    def resolve_expression(self, query=None, **kwargs):
        # As a performance optimization, remove ordering since EXISTS doesn't
        # care about it, just whether or not a row matches.
        self.queryset = self.queryset.order_by()
        return super(Exists, self).resolve_expression(query, **kwargs)
}}}

I've submitted a patch ([https://github.com/django/django/pull/9671]) that adds support for positional arguments for {{{Exists.resolve_expression}}}, but perhaps the intention was for the base method to be keyword-only. "	Bug	closed	Database layer (models, ORM)	2.0	Normal	fixed			Ready for checkin	1	0	0	0	0	0
