#20024: QuerySet.exclude() does not work with lists containing a 'None' element.
-------------------------------------+-------------------------------------
     Reporter:  stillwater.ke@…      |                    Owner:  Adam
                                     |  Sołtysik
         Type:  Bug                  |                   Status:  assigned
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Adam Sołtysik):

 * has_patch:  0 => 1


Comment:

 I've created a
 
[https://github.com/adamsol/django/commit/f50e315ce315ead117bfe4335a9fda758e88ae6f
 patch]. No PR yet, though, because one test fails:
 `WindowFunctionTests.test_window_expression_within_subquery`. SQL doesn't
 support filtering by window functions, so I guess the code should be
 corrected to use another subquery (or maybe an `EXISTS` query).
 Unfortunately I don't know how to write this without using QuerySet
 utilities.

 As for `RelatedIn`, the things are weird here. It seems this case is
 handled differently and already works correctly, and worked even before
 #31667 (`test_ticket20024_related_in`). It was probably fixed in #13815
 long ago. There is `IS NOT NULL` in the subquery, actually there are two
 next to each other. One is coming from `split_exclude()` (called in
 `build_filter()`), but the other one -- I couldn't find. Also, what looks
 like another thing to take a closer look at -- there is `NOT IN (None)`
 instead of `NOT IN (NULL)` in the SQL for the first query in that test,
 when the `rhs.discard(None)` line is removed.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/20024#comment:10>
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/081.11339f62a20dc73d3ff39538a05f49de%40djangoproject.com.

Reply via email to