#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 think we should reserve None only to represent SQL's NULL, and have a
representation for the (string) json's null (I understand this matches the
new JSONNull expression you are proposing).
Yes it matches the `JSONNull` proposal. If we take away the ability to use
`None` for filtering against JSON `null` we should provide an alternative.
The deprecation could look like
1. Introduce `JSONNull`
2. Make `filter(jsonfield=None)` raise a deprecation warning pointing at
either using `filter(jsonfield__isnull=True)` or
`filter(jsonfield=JSONNull)`
3. At the end of the deprecation period switch `filter(jsonfield=None)` to
mean `filter(jsonfield__isnull=True)` link on all other fields
It leaves the problem of having JSON `null` not surviving a round trip to
the database as both SQL `NULL` and `json.loads("null")` are turned into
Python `None` but that's a different issue that can be addressed with a
specialized `decoder` if users require it.
> Would this lookup allow further lookups to be chained?
It could or not, what gets returned from a lookup can be prevent further
chaining if we want.
--
Ticket URL: <https://code.djangoproject.com/ticket/35381#comment:5>
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/0107018f53e6fb74-1b52bc9c-0cb9-475f-b8de-a122ccf56494-000000%40eu-central-1.amazonses.com.