order by('?') unexpectedly breaking queryset aggregation Description
order by('?') unexpectedly breaking queryset aggregation Description: a task in Lego-RL-SWE-Bench-Verified (Harbor dataset). Steps to reproduce: class Thing(models.Model): pass class Related(models.Model): models.ForeignKey(Thing) With data t = Thing.objects.create() rs =…
The task
Steps to reproduce: class Thing(models.Model): pass class Related(models.Model): models.ForeignKey(Thing) With data t = Thing.objects.create() rs = [Related.objects.create(thing=t) for _ in range(2)] The following query works as expected. The aggregation with Count produces a GROUP BY clause on related.id. >>>…
Part of Lego-X/Lego-RL-SWE-Bench-Verified.