#7957 closed (duplicate)
Chaining Queryset.extra() methods that contain parameters breaks the query
Reported by: | Matthijs | Owned by: | Malcolm Tredinnick |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Keywords: | queryset extra select select_params | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
To reproduce:
Precondition a user 'root' exists with id=1
from django.contrib.auth.models import User for result in User.objects.extra(select= {'foo3': "SELECT COUNT(auth_user.id) FROM auth_user WHERE (auth_user.username = %s)"} , select_params=['root']).extra(select= {'foo2': "SELECT COUNT(auth_user.id) FROM auth_user WHERE (auth_user.id = %s)"} , select_params=['1']): print result.foo3 # output should be: # 1 # 1 for result in User.objects.extra(select= {'foo1': "SELECT COUNT(auth_user.id) FROM auth_user WHERE (auth_user.username = %s)"} , select_params=['root']).extra(select= {'foo2': "SELECT COUNT(auth_user.id) FROM auth_user WHERE (auth_user.id = %s)"} , select_params=['1']): print result.foo1 # output should be: # 1 # 1
Attachments (2)
Change History (10)
by , 16 years ago
Attachment: | django_extra.diff added |
---|
comment:1 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 by , 16 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
follow-up: 4 comment:3 by , 16 years ago
Description: | modified (diff) |
---|---|
milestone: | 1.0 beta → 1.0 |
Triage Stage: | Unreviewed → Accepted |
The patch looks like it's along the right lines, although I don't really like adding an append()
method to the sorted dictionary. That's a bit of API creep that we can probably avoid.
Fixed milestone and description.
comment:4 by , 16 years ago
Replying to mtredinnick:
The patch looks like it's along the right lines, although I don't really like adding an
append()
method to the sorted dictionary. That's a bit of API creep that we can probably avoid.
I see the SortedDict more as a list with an additional dict interface. But I am curious how you would solve it.
Also if you are going to work on this ticket you might want to check out ticket #7961 as well since it reports and solves an additional bug in this area of the code.
comment:5 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | reopened → new |
comment:6 by , 16 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
patch to fix extra().extra() problem