#28787: MySQL Update fails
-----------------------------------------+------------------------
Reporter: Paulo | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.11
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
Given the models below:
{{{
class House(models.Model):
name = models.CharField(max_length=200)
class Room(models.Model):
name = models.CharField(max_length=200)
house = models.ForeignKey(House, on_delete=models.CASCADE)
}}}
The following query fails:
{{{
houses_with_suites = House.objects.filter(room__name__icontains='suite')
Room.objects.filter(house__in=houses_with_suites).update(name='suite')
}}}
With this error:
{{{
OperationalError: (1093, "You can't specify target table 'mysql_test_room'
for update in FROM clause")
}}}
I think this has been around for a while
(https://code.djangoproject.com/ticket/20300).
--
Ticket URL: <https://code.djangoproject.com/ticket/28787>
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/051.cc10a6dba0398914c03ac4310c53bf1f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.