mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
[1.8.x] Fixed #24748 -- Fixed incorrect GROUP BY on MySQL in some queries
When the query's model had a self-referential foreign key, the
compiler.get_group_by() code incorrectly used the self-referential
foreign key's column (for example parent_id) as GROUP BY clause
when it should have used the model's primary key column (id).
Backport of adc57632bc from master
This commit is contained in:
committed by
Tim Graham
parent
056a91dbfa
commit
d5ce2dd7bc
@@ -104,3 +104,8 @@ class Bravo(models.Model):
|
||||
class Charlie(models.Model):
|
||||
alfa = models.ForeignKey(Alfa, null=True)
|
||||
bravo = models.ForeignKey(Bravo, null=True)
|
||||
|
||||
|
||||
class SelfRefFK(models.Model):
|
||||
name = models.CharField(max_length=50)
|
||||
parent = models.ForeignKey('self', null=True, blank=True, related_name='children')
|
||||
|
||||
Reference in New Issue
Block a user