#35585: `Query.has_results` calls `.exists()` with wrong argument
-------------------------------------+-------------------------------------
Reporter: Flavio Curella | Owner: (none)
Type: | Status: new
Cleanup/optimization |
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Flavio Curella:
Old description:
> 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 ...
> }}}
New description:
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 ...
}}}
--
--
Ticket URL: <https://code.djangoproject.com/ticket/35585#comment:2>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107019092db8003-aece3b14-c7f7-47e1-95d1-b4307536aadb-000000%40eu-central-1.amazonses.com.