#35381: Regression on json null value constraints in django 4.2
-------------------------------------+-------------------------------------
Reporter: Olivier Tabone | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Simon Charette):
I've looked into it as well and #35167 only provides a partial solution
here IMO as it would require the `Q.check` logic to also pass around
`for_save` to activate the code path it introduces.
I'm starting to believe that in order to finally solve this null ambiguity
problem we should
1. Introduce a `JSONNull` expression to disambigutate between the two. It
would also allow the creation of model instances with a JSON `null` which
is convoluated today as it requires `models.Value(None,
models.JSONField())` to be used.
2. Deprecate `filter(jsonfield=None)` meaning JSON `null` by requiring
`JSONNull` to be used instead. Should we only do this at the top level to
still allow `jsonfield__key=None` to filter against `null` keys? An
alternative would be to introduce a `__jsonnull` lookup.
The ''good news'' is that Django makes it very hard to store JSON null in
the first place since #34754 so this kind of constraints should be rarely
needed.
--
Ticket URL: <https://code.djangoproject.com/ticket/35381#comment:3>
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/0107018f49d2ed8b-ddc5d54d-50c8-4731-b95e-0c5c322d40f1-000000%40eu-central-1.amazonses.com.