#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.