#33414: Diamond inheritance causes duplicated PK error when creating an object, 
if
the primary key field has a default.
-------------------------------------+-------------------------------------
     Reporter:  Yu Li                |                    Owner:  Yu Li
         Type:  Bug                  |                   Status:  assigned
    Component:  Database layer       |                  Version:  4.0
  (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 Simon Charette):

 Thank you for your detailed report.

 I haven't looked into the details of how this can be addressed but one
 thing is certain. When an instance of model class at the ''head'' of a
 diamond inheritance graph is saved the ORM knows that there isn't a reason
 to update involved tables/nodes more than once. In other words, creating a
 `BookReview` should only require 4 queries and not 6 and this issue
 predates babd4126853e48594b61e8db71a83d7bdd929b9c. I believe that's what
 we should focus on solving here as that will address this unfortunate
 collision while reducing the number of queries to a minimum.

 Test coverage for model diamond inheritance is limited given it's a rarely
 used feature and ''good'' core support for fields with Python generated
 defaults is also relatively recent so I'm not surprised we missed this
 relatively obscure edge case in #29129.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33414#comment:5>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.2e7db472bcfb1929d6976a87cbc699db%40djangoproject.com.

Reply via email to