#27594: Reverse one to one related object populated from incorrect query columns
-------------------------------------+-------------------------------------
     Reporter:  Daniel Hillier       |                    Owner:  Daniel
                                     |  Hillier
         Type:  Bug                  |                   Status:  assigned
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  onetoone reverse     |             Triage Stage:
                                     |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Daniel Hillier):

 * owner:  daniel.hillier@… => Daniel Hillier


Old description:

> Extracting data for the related object from a queryset with a self
> referential one to one field gets the wrong data (incorrect columns) from
> the query when using a select_related with the reverse field.
>
> The incorrect columns are introduced by the sqlcompiler mistaking the
> reverse select_related path as a part of a multiple concrete model
> inheritance structure.
>
> The proposed fix tests for self-referential relationships and avoids the
> multiple concrete model inheritance path in those instances.
>
> Test added and all other tests are passing.

New description:

 Extracting data for the related object from a queryset with a self
 referential one to one field gets the wrong data (incorrect columns) from
 the query when using a select_related with the reverse field.

 The incorrect columns are introduced by the sqlcompiler mistaking the
 reverse select_related path as a part of a multiple concrete model
 inheritance structure.

--

Comment:

 The proposed fix tests for self-referential relationships and avoids the
 multiple concrete model inheritance path in those instances.

 Test added and all other tests are passing.

 https://github.com/danifus/django/tree/ticket_27594

--
Ticket URL: <https://code.djangoproject.com/ticket/27594#comment:1>
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/065.94f8ae57a2e90c81921bfda8ef950a70%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to