Opened 13 years ago

Last modified 13 years ago

#16290 closed Bug

slicing in subquery on MySQL DB — at Initial Version

Reported by: anonymous Owned by: nobody
Component: Database layer (models, ORM) Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When I do slicing on a query, and the use that result as a subquery I get the following error, when using MySQL:

"This version of MySQL doesn't yet support'LIMIT & IN/ALL/ANY/SOME subquery'"

objects = Model.objects.filter(key=value).values_list('id', flat=True)[:4]
Model.objects.filter(id__in=objects)

Of course this example makes no sense.
But the workaround I did, was to force django to evaluate the first query, and then use the result as input for the next. Maybe this should be the default, since MySQL doesn't support the action. Or atleast Django should explain the solution of forcing evaluating, and the slowdowns, that might have.(Have no idea if that's the case.)

Change History (0)

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