Skip to content

Commit

Permalink
Use subquery for count and exists (#1624)
Browse files Browse the repository at this point in the history
  • Loading branch information
abondar authored May 23, 2024
1 parent a5be9b6 commit 201e535
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Fixed
- Fix `get_annotations` now evaluates annotations in the default scope instead of the app namespace. (#1552)
- Fix `get_or_create` method. (#1404)
- Use `index_name` instead of `BaseSchemaGenerator._generate_index_name` to generate index name.
- Use subquery for count() and exists() in `QuerySet` to match count result to `QuerySet` result. (#1607)

Changed
^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/test_queryset.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ async def test_annotate_order_expression(self):
self.assertEqual(data[0] + 1, data[1])

async def test_annotate_expression_filter(self):
count = await IntFields.annotate(intnum=F("intnum") + 1).filter(intnum__gt=30).count()
count = await IntFields.annotate(intnum1=F("intnum") + 1).filter(intnum1__gt=30).count()
self.assertEqual(count, 23)

async def test_get_raw_sql(self):
Expand Down

0 comments on commit 201e535

Please sign in to comment.