Opened 5 months ago

Last modified 5 months ago

#35585 closed Bug

`Query.has_results` calls `.exists()` with wrong argument — at Version 2

Reported by: Flavio Curella Owned by:
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Flavio Curella Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Flavio Curella)

The has_results method of the Query class (in django/db/models/sql/query.py), passes the using argument to the exists() method:

    def has_results(self, using):
        q = self.exists(using)
        compiler = q.get_compiler(using=using)
        return compiler.has_results()

but the signature of the exists method does not accept an argument to select the db connection. It only accepts an argument to limit the rows it should fetch:

    def exists(self, limit=True):
        # ... snip ...

Change History (2)

comment:1 by Flavio Curella, 5 months ago

Description: modified (diff)

comment:2 by Flavio Curella, 5 months ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top