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
As I have mentioned in the PR, the release 0.17.6 has broken the usage of .annotate(*).values_list(*).
In previous version 0.17.5, it was working well:
MyModel.objects.filter(relatedmodel__isnull=False).annotate(Count('id')).values_list(
'id', 'name').order_by('name').query
>>> SELECT "app_mymodel"."name_en", "app_mymodel"."id" FROM "app_mymodel"
INNER JOIN "app_relatedmodel" ON ("app_mymodel"."id" = "app_relatedmodel"."mymodel_id")
WHERE "app_relatedmodel"."id" IS NOT NULL
GROUP BY "app_mymodel"."id"
ORDER BY "app_mymodel"."name_en" ASC
while in the newest version 0.17.6 you receive by the very same query a different SQL and results as well:
MyModel.objects.filter(relatedmodel__isnull=False).annotate(Count('id')).values_list(
'id', 'name').order_by('name').query
>>> SELECT "app_mymodel"."id", "app_mymodel"."name_en", COUNT("app_mymodel"."id") AS "id__count" FROM "app_mymodel"
INNER JOIN "app_relatedmodel" ON ("app_mymodel"."id" = "app_relatedmodel"."mymodel_id")
WHERE "app_relatedmodel"."id" IS NOT NULL
GROUP BY "app_mymodel"."id"
ORDER BY "app_mymodel"."name_en" ASC
Note the difference in the SELECT clause. Incorrect order, incorrect number of fields and one incorrect field at all.
The text was updated successfully, but these errors were encountered:
Please consider any way to help Ukraine defeat Russia. I'm safe becouse Ukrainian Army is protecting me, but we need support: https://supportukrainenow.org/
As I have mentioned in the PR, the release
0.17.6
has broken the usage of.annotate(*).values_list(*)
.In previous version
0.17.5
, it was working well:while in the newest version
0.17.6
you receive by the very same query a different SQL and results as well:Note the difference in the
SELECT
clause. Incorrect order, incorrect number of fields and one incorrect field at all.The text was updated successfully, but these errors were encountered: