#20024: 'exclude' does not work with lists containing a 'None' element.
-------------------------------------+-------------------------------------
Reporter: stillwater.ke@… | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.4
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by akaariai):
* needs_better_patch: => 0
* stage: Unreviewed => Accepted
* type: Uncategorized => Bug
* needs_tests: => 0
* needs_docs: => 0
Comment:
This is a known failure (tested in queries/tests.py,
test_col_not_in_list_containing_null()).
This is somewhat hard to fix as SQL's "somecol NOT IN lst_containing_null"
is weird - it will always return False (well, technically UNKNOWN but this
doesn't matter here), and this is what causes the bug.
It would be possible to check for presence of None in the given list. If
present, remove it and add in a proper IS NULL check instead. But then a
query like `.exclude(somecol__in=qs_containig_null)` would work
differently from `.exclude(somecol__in=list(qs_containig_null))`. I guess
that could be classified as known abstraction leak.
--
Ticket URL: <https://code.djangoproject.com/ticket/20024#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.