﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
24254	"Passing a query to ""pk__in"" of another query may result in invalid SQL"	Torsten Bronger	nobody	"Consider the following model:

{{{
from django.db import models

class MyModel(models.Model):
    name = models.CharField(max_length=200)

    class Meta:
        ordering = (""name"",)
}}}

Then, the following query:

{{{
MyModel.objects.filter(pk__in=MyModel.objects.all().distinct()[:10])
}}}

results in an invalid SQL query.  SQLite complains with ""only a single result allowed for a SELECT that is part of an expression""."	Bug	new	Database layer (models, ORM)	1.7	Normal			bronger@…	Unreviewed	0	0	0	0	0	0
