Re: [Django] #19672: Negated Q objects over nullable joins result in invalid SQL

2013-02-20 Thread Django
#19672: Negated Q objects over nullable joins result in invalid SQL
-+-
 Reporter:  ikelly   |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:  fixed
 Severity:  Normal   | Triage Stage:  Ready for
 Keywords:  Q ForeignKey |  checkin
  nullable   |  Needs documentation:  0
Has patch:  1|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-

Comment (by Anssi Kääriäinen ):

 In [changeset:"8ad436636fd385abd144274952b0c066885af042"]:
 {{{
 #!CommitTicketReference repository=""
 revision="8ad436636fd385abd144274952b0c066885af042"
 [1.5.x] Fixed #19672 -- Error in negated Q() filtering

 There was a variable overwrite error in negated join filtering. This
 happened when add_filter() was adding the IS NULL condition to the
 WHERE clause.

 This is not a backport from master as there have been some other
 refactorings which made this patch irrelevant.

 The patch is from Ian Kelly.
 }}}

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #19672: Negated Q objects over nullable joins result in invalid SQL

2013-02-20 Thread Django
#19672: Negated Q objects over nullable joins result in invalid SQL
-+-
 Reporter:  ikelly   |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:  fixed
 Severity:  Normal   | Triage Stage:  Ready for
 Keywords:  Q ForeignKey |  checkin
  nullable   |  Needs documentation:  0
Has patch:  1|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by Anssi Kääriäinen ):

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


Comment:

 In [changeset:"e8fc3f3783744e4fcd3ff0ac43e3ce2572292f3a"]:
 {{{
 #!CommitTicketReference repository=""
 revision="e8fc3f3783744e4fcd3ff0ac43e3ce2572292f3a"
 Added a test for negated Q object querying

 The added test is from the patch in ticket #19672 (written by Ian
 Kelly). Fixed #19672, refs #19849.
 }}}

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #19672: Negated Q objects over nullable joins result in invalid SQL

2013-01-28 Thread Django
#19672: Negated Q objects over nullable joins result in invalid SQL
-+-
 Reporter:  ikelly   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Ready for
 Keywords:  Q ForeignKey |  checkin
  nullable   |  Needs documentation:  0
Has patch:  1|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-

Comment (by ikelly):

 That sounds reasonable to me.

-- 
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 https://groups.google.com/groups/opt_out.




Re: [Django] #19672: Negated Q objects over nullable joins result in invalid SQL

2013-01-25 Thread Django
#19672: Negated Q objects over nullable joins result in invalid SQL
-+-
 Reporter:  ikelly   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Ready for
 Keywords:  Q ForeignKey |  checkin
  nullable   |  Needs documentation:  0
Has patch:  1|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by akaariai):

 * stage:  Unreviewed => Ready for checkin


Comment:

 The patch looks good to me.

 What versions to patch? I think 1.4 is out of reach, this isn't a crashing
 or data loss bug.

 1.5 is technically also in "crash, data-loss, security, regression" fixes
 only as it is in RC, but as we are going to do RC2 and the patch is as
 safe as they get, IMO master + stable/1.5.x seems like the correct way.

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #19672: Negated Q objects over nullable joins result in invalid SQL

2013-01-25 Thread Django
#19672: Negated Q objects over nullable joins result in invalid SQL
-+-
 Reporter:  ikelly   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:
 Keywords:  Q ForeignKey |  Unreviewed
  nullable   |  Needs documentation:  0
Has patch:  1|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by ikelly):

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


Comment:

 The bug seems to happen because a local variable gets clobbered in the
 Query.add_filter method.  I've uploaded a patch and tests to fix this.

-- 
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 https://groups.google.com/groups/opt_out.




[Django] #19672: Negated Q objects over nullable joins result in invalid SQL

2013-01-25 Thread Django
#19672: Negated Q objects over nullable joins result in invalid SQL
--+
 Reporter:  ikelly|  Owner:  nobody
 Type:  Bug   | Status:  new
Component:  Database layer (models, ORM)  |Version:  master
 Severity:  Normal|   Keywords:  Q ForeignKey
 Triage Stage:  Unreviewed|  nullable
Easy pickings:  0 |  Has patch:  0
  |  UI/UX:  0
--+
 Using the following set of models:

 {{{
 from django.db import models

 class A(models.Model):
 value = models.IntegerField(null=True)

 class B(models.Model):
 a = models.ForeignKey(A)

 class C(models.Model):
 b = models.ForeignKey(B, null=True)
 }}}

 The query {{{C.objects.filter(~Q(b__a__value=42))}}} fails with the
 following error:

 {{{DatabaseError: no such column: testapp_b.value}}}

 The SQL generated is:

 {{{
 SELECT "testapp_c"."id", "testapp_c"."b_id" FROM "testapp_c" LEFT OUTER
 JOIN "t
 estapp_b" ON ("testapp_c"."b_id" = "testapp_b"."id") LEFT OUTER JOIN
 "testapp_a"
  ON ("testapp_b"."a_id" = "testapp_a"."id") WHERE NOT
 (("testapp_a"."value" = 42
   AND NOT ("testapp_b"."id" IS NULL) AND "testapp_b"."value" IS NOT NULL))
 }}}

 The problem is caused by the last WHERE condition, which is incorrectly
 filtering on the "value" column in the testapp_b table (where it does not
 exist) instead of in the testapp_a table.

-- 
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 https://groups.google.com/groups/opt_out.