You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yeah, there are some shenanigans going on with count, because we calculate it without nesting query inside another select, and because of that we capture some bugs like this on when working with joins
Probably should just wrap all count requests inside outer select count(*)
You can try to make PR about it, or may be I will do it later
I looked at the definition of the queryset.CountQuery class and did not understand how to do this in accordance with the existing rules. My subjective experience tells me to simply replace the body of the queryset.QuerySet.count() method with the body of the example function sql_count(). Since both approaches query the database with almost identical SQL, it does not look like an overhead, but returning the correct result.
With your permission, I leave this decision within your competence. Thank you for your time.
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior, preferably a small code snippet.
Output:
Expected behavior
A clear and concise description of what you expected to happen.
Output:
Additional context
Add any other context about the problem here.
Windows 10
Python 3.11.5
tortoise-orm 0.20.1
The text was updated successfully, but these errors were encountered: