#33785: Broken __in lookup for keys of json field
-------------------------------------+-------------------------------------
     Reporter:  Maksim Iakovlev      |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  3.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  duplicate
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

 * status:  new => closed
 * resolution:   => duplicate


Comment:

 Replying to [ticket:33785 Maksim Iakovlev]:
 > {{{
 > MyModel.objects.exclude(model_field__json_field__in=['', None])
 > }}}
 >
 > I expect only x3 record in result, but x2 presents too.

 This is a duplicate of #20024.

 > This is also wrong:
 >
 > {{{
 >
 
MyModel.objects.exclude(model_field__json_field='').exclude(model_field__json_field__isnull=True)
 > }}}

 It's [https://docs.djangoproject.com/en/stable/topics/db/queries/#key-
 index-and-path-transforms documented] that `__isnull` on key transforms
 are using ''"To query for missing keys"'', not to query for a `None`
 value.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33785#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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018162f342c7-50fd24ee-decd-45f3-a621-8935753ec102-000000%40eu-central-1.amazonses.com.

Reply via email to