#34754: CheckConstraint with isnull lookup on JSONField transform None into null
jsonb value
-------------------------------------+-------------------------------------
     Reporter:  Alexandre Collet     |                    Owner:  Simon
                                     |  Charette
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  4.2
  (models, ORM)                      |
     Severity:  Release blocker      |               Resolution:  fixed
     Keywords:  constraint,          |             Triage Stage:  Ready for
  jsonfield, none, check             |  checkin
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

 In [changeset:"3a1863319c1ed4bc81fe270b0d7d25c7f03fdb48" 3a186331]:
 {{{
 #!CommitTicketReference repository=""
 revision="3a1863319c1ed4bc81fe270b0d7d25c7f03fdb48"
 [4.2.x] Fixed #34754 -- Fixed JSONField check constraints validation on
 NULL values.

 The __isnull lookup of JSONField must special case
 Value(None, JSONField()) left-hand-side in order to be coherent with
 its convoluted null handling.

 Since psycopg>=3 offers no way to pass a NULL::jsonb the issue is
 resolved by optimizing IsNull(Value(None), True | False) to
 True | False.

 Regression in 5c23d9f0c32f166c81ecb6f3f01d5077a6084318.

 Thanks Alexandre Collet for the report.

 Backport of 3434dbd39d373df7193ad006b970c09c1a909ea3 from main
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34754#comment:7>
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/01070189bfc5ac91-8056fcf6-6beb-4c26-b2ee-a91844e7da15-000000%40eu-central-1.amazonses.com.

Reply via email to