Re: [Django] #10032: ORM switches incorrectly to OUTER JOIN in certain cases with isnull=True

2009-05-11 Thread Django
#10032: ORM switches incorrectly to OUTER JOIN in certain cases with isnull=True
---+
  Reporter:  gabor | Owner:  nobody
Status:  closed| Milestone:  1.1   
 Component:  Database layer (models, ORM)  |   Version:  1.0   
Resolution:  wontfix   |  Keywords:
 Stage:  Accepted  | Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Changes (by gabor):

 * cc: ga...@nekomancer.net (added)

-- 
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 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
-~--~~~~--~~--~--~---



Re: [Django] #10032: ORM switches incorrectly to OUTER JOIN in certain cases with isnull=True

2009-05-08 Thread Django
#10032: ORM switches incorrectly to OUTER JOIN in certain cases with isnull=True
---+
  Reporter:  gabor | Owner:  nobody
Status:  closed| Milestone:  1.1   
 Component:  Database layer (models, ORM)  |   Version:  1.0   
Resolution:  wontfix   |  Keywords:
 Stage:  Accepted  | Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Changes (by jacob):

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

Comment:

 As Malcolm said, this behavior is by intent. If you've got an issue with
 that intent please take it up on django-dev, but please don't reopen
 tickets closed by a committer.

-- 
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 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
-~--~~~~--~~--~--~---



Re: [Django] #10032: ORM switches incorrectly to OUTER JOIN in certain cases with isnull=True

2009-05-08 Thread Django
#10032: ORM switches incorrectly to OUTER JOIN in certain cases with isnull=True
---+
  Reporter:  gabor | Owner:  nobody
Status:  reopened  | Milestone:  1.1   
 Component:  Database layer (models, ORM)  |   Version:  1.0   
Resolution:|  Keywords:
 Stage:  Accepted  | Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Changes (by gabor):

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

Comment:

 i'm fine with any way, as long as it is consistent.
 but:

 when i do this:

 {{{
 >>> list(Group.objects.filter(person__stamp__isnull=True))
 []
 }}}

 i get an OUTER JOIN

 but when i do this:

 {{{
 >>> list(Group.objects.filter(person__stamp='2008-12-12'))
 []
 }}}

 i get an INNER JOIN.

 i think it's incorrect that django switches to a different join_type
 just because i used an {{{ isnull=True }}}. please note,
 that the "stamp" field is not a foreignkey, it's just a normal field.
 it has no active role in this JOIN.

-- 
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 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
-~--~~~~--~~--~--~---



Re: [Django] #10032: ORM switches incorrectly to OUTER JOIN in certain cases with isnull=True

2009-02-27 Thread Django
#10032: ORM switches incorrectly to OUTER JOIN in certain cases with isnull=True
---+
  Reporter:  gabor | Owner:  nobody
Status:  closed| Milestone:  1.1   
 Component:  Database layer (models, ORM)  |   Version:  1.0   
Resolution:  invalid   |  Keywords:
 Stage:  Accepted  | Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Changes (by mtredinnick):

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

Comment:

 There's no way for Django to read the user's mind here and there are two
 quite acceptable ways to interpret that filter. Django has chosen one way
 (which matches the fairly natural way the equivalent SQL query might fall
 out). You have chosen the other way. Unfortunately we can't have both.

 You will need to write your query as
 {{{
 #!python
 Group.objects.filter(person__stamp__isnull=True, person__isnul=False)
 }}}
 or, similarly,
 {{{
 #!python
 Group.objects.exclude(person=None).filter(person__stamp=None)
 }}}
 etc.

 The current behaviour isn't "incorrect". It's an interpretation of an
 ambiguous situation and we're very consistent about how that
 interpretation is applied. If you'd like to propose a documentation
 clarification, that would be worth looking at.

-- 
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 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
-~--~~~~--~~--~--~---



Re: [Django] #10032: ORM switches incorrectly to OUTER JOIN in certain cases with isnull=True

2009-02-27 Thread Django
#10032: ORM switches incorrectly to OUTER JOIN in certain cases with isnull=True
---+
  Reporter:  gabor | Owner:  nobody
Status:  new   | Milestone:  1.1   
 Component:  Database layer (models, ORM)  |   Version:  1.0   
Resolution:|  Keywords:
 Stage:  Accepted  | Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Changes (by jacob):

  * needs_better_patch:  => 0
  * needs_docs:  => 0
  * stage:  Unreviewed => Accepted
  * needs_tests:  => 0
  * milestone:  => 1.1

-- 
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 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
-~--~~~~--~~--~--~---



[Django] #10032: ORM switches incorrectly to OUTER JOIN in certain cases with isnull=True

2009-01-15 Thread Django
#10032: ORM switches incorrectly to OUTER JOIN in certain cases with isnull=True
--+-
 Reporter:  gabor |   Owner:  nobody
   Status:  new   |   Milestone:
Component:  Database layer (models, ORM)  | Version:  1.0   
 Keywords:|   Stage:  Unreviewed
Has_patch:  0 |  
--+-
 using postgresql-8.2, with the postgresql-psycopg2 db-connector,
 python-2.5

 imagine the following case:

 {{{
 from django.db.models import *

 class Group(Model):
 name = CharField(max_length=20)

 def __unicode__(self):
 return self.name


 class Person(Model):
 name = CharField(max_length=20)
 group = ForeignKey(Group)
 stamp = DateTimeField(blank = True, null = True)

 def __unicode__(self):
 return self.name
 }}}

 now let's do this (empty db):

 {{{
 >>> Group.objects.create(name='group1')
 
 >>> list(Group.objects.filter(person__stamp__isnull=True))
 []
 }}}

 this is not what i want to get, because there are no person objects at
 all,
 so there obviously is no person objects that satisfies the requirement.

 the mentioned query produces this SQL:

 {{{
 SELECT "x_group"."id", "x_group"."name" FROM "x_group" LEFT OUTER JOIN
 "x_person" ON ("x_group"."id" = "x_person"."group_id") WHERE
 "x_person"."stamp" IS NULL
 }}}

 if i change it to INNER JOIN, then it works correctly.

 the strange thing is, that only isnull=True seems to trigger this.
 for example the following:

 {{{
 >>> list(Group.objects.filter(person__stamp='2008-12-12'))
 []
 }}}

 works correctly, and produces this SQL:

 {{{
 SELECT "x_group"."id", "x_group"."name" FROM "x_group" INNER JOIN
 "x_person" ON ("x_group"."id" = "x_person"."group_id") WHERE
 "x_person"."stamp" = E\'2008-12-12 00:00:00\'
 }}}

 this problem appeared with changeset 7477 (merging in the queryset-
 refactor branch).
 with older versions the code works 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 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
-~--~~~~--~~--~--~---