Opened 2 months ago
Last modified 3 weeks ago
#36508 assigned Bug
Asymmetry between exact and iexact when filtering JSON keys against None — at Initial Version
Reported by: | Jacob Walls | Owned by: | |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 5.2 |
Severity: | Normal | Keywords: | null, jsonfield |
Cc: | Sage Abdullah | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
exact
and iexact
vary in their treatment of None
when looking up JSON key paths:
optional_param = request.GET.get("param") qs1 = Model.objects.filter(json__key=optional_param) qs2 = Model.objects.filter(json__key__iexact=optional_param)
fiddle showing exact
queries return rows where the json key is null, but iexact
queries do not (instead, they check for key existence, e.g. __key__isnull
)
Previous ticket regarding symmetry between exact
and iexact
: #21552
Previous ticket regarding iexact
on JSON key lookups: #27693
Note:
See TracTickets
for help on using tickets.