Re: [Django] #23791: Subqueries with non-"id" OneToOneField primary keys try to join against the wrong column name

2015-06-29 Thread Django
#23791: Subqueries with non-"id" OneToOneField primary keys try to join against 
the
wrong column name
-+-
 Reporter:  ris  |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  orm primary_key  | Triage Stage:  Ready for
  OneToOneField subquery values  |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham ):

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


Comment:

 In [changeset:"9ed82154bd0bd01c6195942db84302e791ad366f" 9ed8215]:
 {{{
 #!CommitTicketReference repository=""
 revision="9ed82154bd0bd01c6195942db84302e791ad366f"
 Fixed #23791 -- Corrected object type check for pk__in=qs

 When the pk was a relation field, qs.filter(pk__in=qs) didn't work.

 In addition, fixed Restaurant.objects.filter(place=restaurant_instance),
 where place is an OneToOneField and the primary key of Restaurant.

 A big thank you to Josh for review and to Tim for review and cosmetic
 edits.

 Thanks to Beauhurst for commissioning the work on this ticket.
 }}}

--
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/061.bed41f90ba04e7c6691194366c2275d9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23791: Subqueries with non-"id" OneToOneField primary keys try to join against the wrong column name

2015-06-27 Thread Django
#23791: Subqueries with non-"id" OneToOneField primary keys try to join against 
the
wrong column name
-+-
 Reporter:  ris  |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  orm primary_key  | Triage Stage:  Ready for
  OneToOneField subquery values  |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by timgraham):

 * has_patch:  0 => 1
 * stage:  Accepted => Ready for checkin


Comment:

 [https://github.com/django/django/pull/4918 PR] from Anssi.

--
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/061.ed5785b7563a8d25c2e09848df194f06%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23791: Subqueries with non-"id" OneToOneField primary keys try to join against the wrong column name

2014-11-24 Thread Django
#23791: Subqueries with non-"id" OneToOneField primary keys try to join against 
the
wrong column name
-+-
 Reporter:  ris  |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:  orm primary_key  |  Needs documentation:  0
  OneToOneField subquery values  |  Patch needs improvement:  0
Has patch:  0|UI/UX:  0
  Needs tests:  0|
Easy pickings:  0|
-+-
Changes (by timgraham):

 * version:  1.7 => master
 * stage:  Unreviewed => Accepted


Comment:

 I can reproduce using the attached test. Doesn't appear to be a recent
 regression though (I tested back to 1.5).

--
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/061.cc12271a16bf5955caa24d23722f58e3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23791: Subqueries with non-"id" OneToOneField primary keys try to join against the wrong column name

2014-11-10 Thread Django
#23791: Subqueries with non-"id" OneToOneField primary keys try to join against 
the
wrong column name
-+-
 Reporter:  ris  |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  1.7
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:
 Keywords:  orm primary_key  |  Unreviewed
  OneToOneField subquery values  |  Needs documentation:  0
Has patch:  0|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-

Comment (by ris):

 Having said the workaround behaves correctly, I realize adding .values
 (...) screws up the ordering of the subquery, which is important if using
 .distinct (...). Similar effects to #23622

--
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/061.9cc334473f008b5217399e084f6e56a2%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23791: Subqueries with non-"id" OneToOneField primary keys try to join against the wrong column name

2014-11-10 Thread Django
#23791: Subqueries with non-"id" OneToOneField primary keys try to join against 
the
wrong column name
-+-
 Reporter:  ris  |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  1.7
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:
 Keywords:  orm primary_key  |  Unreviewed
  OneToOneField subquery values  |  Needs documentation:  0
Has patch:  0|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by ris):

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


Old description:

> Hi, your favourite ORM obscure-query bug reporter again here...
>
> Using Django 1.7.1 & postgres, example models.py:
>
> {{{
> class ModelA ( models.Model ):
> x = models.TextField ()
>
> class ModelB ( models.Model ):
> a = models.OneToOneField ( ModelA , primary_key = True )
> }}}
>
> issuing the query
>
> {{{
> >>> ModelC.objects.filter ( pk__in = ModelC.objects.filter ( a__x = "abc"
> ) )
> }}}
>
> results in
>
> {{{
> FieldError: Cannot resolve keyword u'id' into field. Choices are: a, a_id
> }}}
>
> A workaround exists:
>
> {{{
> >>> ModelC.objects.filter ( pk__in = ModelC.objects.filter ( a__x = "abc"
> ).values ( "pk" ) )
> }}}
>
> which behaves correctly.

New description:

 Hi, your favourite ORM obscure-query bug reporter again here...

 Using Django 1.7.1 & postgres, example models.py:

 {{{
 class ModelA ( models.Model ):
 x = models.TextField ()

 class ModelB ( models.Model ):
 a = models.OneToOneField ( ModelA , primary_key = True )
 }}}

 issuing the query

 {{{
 >>> ModelB.objects.filter ( pk__in = ModelB.objects.filter ( a__x = "abc"
 ) )
 }}}

 results in

 {{{
 FieldError: Cannot resolve keyword u'id' into field. Choices are: a, a_id
 }}}

 A workaround exists:

 {{{
 >>> ModelB.objects.filter ( pk__in = ModelB.objects.filter ( a__x = "abc"
 ).values ( "pk" ) )
 }}}

 which behaves correctly.

--

--
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/061.024982df3074b3e1e4e112945c6cb2f9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #23791: Subqueries with non-"id" OneToOneField primary keys try to join against the wrong column name

2014-11-10 Thread Django
#23791: Subqueries with non-"id" OneToOneField primary keys try to join against 
the
wrong column name
-+-
 Reporter:  ris  |  Owner:  nobody
 Type:  Bug  | Status:  new
Component:  Database layer   |Version:  1.7
  (models, ORM)  |   Keywords:  orm primary_key
 Severity:  Normal   |  OneToOneField subquery values
 Triage Stage:  Unreviewed   |  Has patch:  0
Easy pickings:  0|  UI/UX:  0
-+-
 Hi, your favourite ORM obscure-query bug reporter again here...

 Using Django 1.7.1 & postgres, example models.py:

 {{{
 class ModelA ( models.Model ):
 x = models.TextField ()

 class ModelB ( models.Model ):
 a = models.OneToOneField ( ModelA , primary_key = True )
 }}}

 issuing the query

 {{{
 >>> ModelC.objects.filter ( pk__in = ModelC.objects.filter ( a__x = "abc"
 ) )
 }}}

 results in

 {{{
 FieldError: Cannot resolve keyword u'id' into field. Choices are: a, a_id
 }}}

 A workaround exists:

 {{{
 >>> ModelC.objects.filter ( pk__in = ModelC.objects.filter ( a__x = "abc"
 ).values ( "pk" ) )
 }}}

 which behaves correctly.

--
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/046.a3048dd69d1deb4931b45184ddaa3834%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.