#35585: `Query.has_results` calls `.exists()` with wrong argument
-------------------------------------+-------------------------------------
Reporter: Flavio Curella | Type:
| Cleanup/optimization
Status: new | Component: Database
| layer (models, ORM)
Version: dev | Severity: Normal
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
The `has_results` method of the `Query` class (in
`django/db/models/sql/query.py`), passes the `using` argument to the
`exists()` method:
```python
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:
```python
def exists(self, limit=True):
# ... snip ...
```
--
Ticket URL: <https://code.djangoproject.com/ticket/35585>
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/0107019092d8868e-3738c329-a513-472b-be61-a44b00d140bd-000000%40eu-central-1.amazonses.com.