[Django] #24608: Chaining inherited models with UUID primary key does not work in MySQL

21 views
Skip to first unread message

Django

unread,
Apr 8, 2015, 5:04:47 PM4/8/15
to django-...@googlegroups.com
#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.

Django

unread,
Apr 8, 2015, 5:07:45 PM4/8/15
to django-...@googlegroups.com
#24608: Chaining inherited models with UUID primary key does not work in MySQL
-------------------------------------+-------------------------------------

Reporter: sebst | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.8
(models, ORM) |
Severity: Normal | Resolution:

Keywords: mysql uuid | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by sebst):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

On sqlite3 backend, the error will be:

{{{
InterfaceError: Error binding parameter 1 - probably unsupported type.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24608#comment:1>

Django

unread,
Apr 8, 2015, 6:42:42 PM4/8/15
to django-...@googlegroups.com
#24608: Chaining inherited models with UUID primary key does not work in MySQL
-------------------------------------+-------------------------------------

Reporter: sebst | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.8
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: mysql uuid | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* severity: Normal => Release blocker
* stage: Unreviewed => Accepted


Comment:

Can reproduce with the attached test.

--
Ticket URL: <https://code.djangoproject.com/ticket/24608#comment:2>

Django

unread,
Apr 8, 2015, 6:43:05 PM4/8/15
to django-...@googlegroups.com
#24608: Chaining inherited models with UUID primary key does not work in MySQL
-------------------------------------+-------------------------------------

Reporter: sebst | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.8
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: mysql uuid | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* Attachment "24608-test.diff" added.

Django

unread,
Apr 9, 2015, 2:00:23 PM4/9/15
to django-...@googlegroups.com
#24608: Chaining inherited models with UUID primary key does not work in MySQL
-------------------------------------+-------------------------------------
Reporter: sebst | Owner: nobody
Type: Bug | Status: closed

Component: Database layer | Version: 1.8
(models, ORM) |
Severity: Release blocker | Resolution: duplicate

Keywords: mysql uuid | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* status: new => closed
* resolution: => duplicate


Comment:

Seems to be fixed by #24611 which has a patch.

--
Ticket URL: <https://code.djangoproject.com/ticket/24608#comment:3>

Reply all
Reply to author
Forward
0 new messages