﻿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
25260	"Sets in ""in"" lookups should be converted to list if backend doesn't support sets"	no	nobody	"Consider the following:
{{{#!python
Model.objects.filter(pk__in = set([1, 1, 2, 3, 4, 3]))
}}}

If the backend is mysql, the generated SQL will contain `WHERE id IN (1, 2, 3, 4)`. If the backend is postgresql there is an error: ""can't adapt type 'set'"".

Argument: switching between backends should not throw an error from the backend if the plain ORM (no backend-specific elements) is used.

I'm not sure where this belongs, but django shouldn't be throwing a backend error for this case.
Some potential fixes:
- Call `list()` on any iterable that's used for `__in` filters. (Preferable for me, should be non-breaking except in edge-cases)
- Disallow `set`s for all backends. (Enforces the same behaviour across all backends, but backward incompatible)
- Add adapter for sets to postgresql backend. (Might cause strange behaviour in cases where the set is used for other contexts)"	Uncategorized	closed	Database layer (models, ORM)	1.8	Normal	invalid			Unreviewed	0	0	0	0	0	0
