#16733: pk/id bug in multiple inheritance of concrete classes
-------------------------------------+-------------------------------------
               Reporter:  Leo        |          Owner:  nobody
                   Type:  Bug        |         Status:  reopened
              Milestone:             |      Component:  Database layer
                Version:  SVN        |  (models, ORM)
             Resolution:             |       Severity:  Normal
           Triage Stage:             |       Keywords:
  Unreviewed                         |      Has patch:  0
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
Changes (by Leo):

 * status:  closed => reopened
 * resolution:  needsinfo =>


Comment:

 Sorry, I should have provided code. There's a couple of ways to demo this
 problem.

 Here's what I actually ran into. If you have a c that starts out like
 this:

 {{{#!python
 >>> c.__dict__
 {'_state': <django.db.models.base.ModelState object at 0x05D1F550>,
  'a_ptr_id': 1,
  'b_ptr_id': 9,
  'id': 9}
 }}}

 You get this behavior:
 {{{#!python
 >>> c.id
 9
 >>> c.pk
 1
 }}}

 Doing a `C.objects.get(pk=9)` fails as does a `C.objects.get(id=1)` while
 their complements do work.

 Another way to demo this issue from scratch is this data loss bug:
 {{{#!python
 >>> b = B.objects.create()
 >>> b.id
 1L
 >>> c = C.objects.create()
 >>> c.__dict__
 Out[6]:
 {'_state': <django.db.models.base.ModelState object at 0x05A48490>,
  'a_ptr_id': 1L,
  'b_ptr_id': 1L,
  'id': 1L}
 }}}

 c should have a b_ptr_id of 2L since there's already a B with id of 1L.
 The B with id of 1L just got clobbered by the data in c.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/16733#comment:2>
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to