#26539: Using Annotation As Update Parameter Generates Invalid SQL
-------------------------------------+-------------------------------------
Reporter: dsanders11 | Owner: PREM1980
Type: Bug | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by PREM1980):
I ran against the dev version but the queries generated are something
different.
models.py
{{{
class Bar(models.Model):
name = models.CharField(max_length=32)
class Foo(models.Model):
related_bar = models.ForeignKey(Bar)
bar_name = models.CharField(max_length=32)
}}}
If you notice the sql that is generated in inner join and not outer join
as you mentioned.
{{{
>>> Foo.objects.annotate(b_name=F('related_bar__name'))
SELECT `polls_foo`.`id`,
`polls_foo`.`related_bar_id`,
`polls_foo`.`bar_name`,
`polls_bar`.`name` AS `b_name`
FROM `polls_foo`
INNER JOIN `polls_bar` ON (`polls_foo`.`related_bar_id` =
`polls_bar`.`id`) LIMIT 21 [0.34ms]
}}}
Can you please clarify on it?
--
Ticket URL: <https://code.djangoproject.com/ticket/26539#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/068.e9644889aa353c7ad8e2d2726f202941%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.