#26908: jsonfield__key__isnull lookup crashes ----------------------------------+------------------------------------ Reporter: sigfrido | Owner: Type: Bug | Status: new Component: contrib.postgres | Version: 1.9 Severity: Normal | Resolution: Keywords: jsonb,postgresql | Triage Stage: Accepted Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 1 | UI/UX: 0 ----------------------------------+------------------------------------
Comment (by sigfrido): You're right, I didn't notice: {{{ (('{"key": null}' :: jsonb) -> 'key') = 'null'::jsonb -- which is different from SQL null, thus: (('{"key": null}' :: jsonb) -> 'key') is null = false -- but: (('{"key": null}' :: jsonb) ->> 'key') is null = true }}} so after the fix, I believe the '''isnull''' lookup would behave exactly as '''has_key'''. I won't expect that. There would be no way to find instances having a {'key':null}. On the other hand, on PG docs they say that jsonb 'null' and SQL NULL have different meaning. Should we introduce a new lookup '''is_null_json''' maybe? -- Ticket URL: <https://code.djangoproject.com/ticket/26908#comment:2> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/066.b12c0fbd98b2960d8b273e854b2c8b6f%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.