#24608: Chaining inherited models with UUID primary key does not work in MySQL
----------------------------------------------+------------------------
Reporter: sebst | Owner: nobody
Type: Bug | Status: new
Component: Database layer (models, ORM) | Version: 1.8
Severity: Normal | Keywords: mysql uuid
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------------------+------------------------
Consider this models:
{{{
class XYZ(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4,
editable=False)
t = models.PositiveSmallIntegerField(default=1)
class ABC(XYZ):
t2 = models.PositiveSmallIntegerField(default=2)
class DEF(ABC):
t3 = models.PositiveSmallIntegerField(default=3)
}}}
When running this code
{{{
a=ADEF(t3=4)
a.save()
}}}
everything is ok.
However, calling a.save a second time will cause:
{{{
IntegrityError: (1062, "Duplicate entry '51a29210bbe64e13af5786968b54046a'
for key 'PRIMARY'")
}}}
on a MySQL host.
--
Ticket URL: <https://code.djangoproject.com/ticket/24608>
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/048.f78d834a6905d81691ea574a3f7a9922%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.