Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#8063 closed (fixed)

Taking a slice of a queryset does not respect extra(...)

Reported by: zbyte64 Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Keywords: queryset
Cc: zbyte64@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Malcolm Tredinnick)

If you do a qs as the following:

>>> foo = MyObjects.objects.all().extra(select={'relevance': match_expr}, where=[match_expr], params=[query])
>>> print foo
>>> bar = MyObjects.objects.all().extra(select={'relevance': match_expr}, where=[match_expr], params=[query])

>>> print bar[:10]

The first 10 elements of foo may not match bar, bar will simply be the first 10 objects and it discards the extra where clause.

Change History (7)

comment:1 by Matt McClanahan, 16 years ago

Component: UncategorizedDatabase wrapper

comment:2 by adamfast, 16 years ago

milestone: 1.0
Triage Stage: UnreviewedAccepted

comment:3 by Malcolm Tredinnick, 16 years ago

Description: modified (diff)

comment:4 by Malcolm Tredinnick, 16 years ago

Summary: Taking a slice of a queryset with extras specified alters the queryTaking a slice of a queryset does not respect extra(...)

Changing the description, because I keep seeing it in summaries and thinking "of course it does. Otherwise there would be no point!", which isn't really what the problem is about.

comment:5 by Malcolm Tredinnick, 16 years ago

(In [8427]) Added a test to show that #8063 doesn't seem to be an issue any longer.
Refs #8063.

comment:6 by Malcolm Tredinnick, 16 years ago

Resolution: fixed
Status: newclosed

I cannot duplicate this in any fashion. In [8427], I've added a test in case to make sure this doesn't become an issue again, but it seems to have been fixed by something in the interim.

If anybody thinks it still exists, please create a modification of the above test to show the problem so that we have some repeatable to debug (the original report in this ticket doesn't details on a concrete test, since information about match_expr and so forth are missing).

comment:7 by Jacob, 13 years ago

milestone: 1.0

Milestone 1.0 deleted

Note: See TracTickets for help on using tickets.
Back to Top