﻿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
29932	Queryset `difference()` after `intersection()` returns wrong queryset on SQLite	michaeldel	nobody	"Considering a simple model
{{{
#!python
from django.db import models

class Foo(models.Model):
    pass
}}}

Here is the minimal way to encounter this issue
{{{
#!python
Foo.objects.create(pk=1)
Foo.objects.create(pk=2)

a = Foo.objects.all()
b = Foo.objects.intersection(Foo.objects.filter(pk=1))

assert a.count() == 2
assert b.count() == 1

diff = a.difference(b)

assert diff.exists()  # fails with SQLite!
}}}
This operation however works as expected on PostgreSQL."	Bug	new	Database layer (models, ORM)	2.1	Normal		queryset sqlite difference intersection		Unreviewed	0	0	0	0	0	0
