﻿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 incorrect results on SQLite and Oracle	michaeldel	Mariusz Felisiak	"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	closed	Database layer (models, ORM)	2.1	Normal	fixed	queryset sqlite difference intersection		Accepted	1	0	0	0	0	0
