#32882: Problems when comparing two fields with None value using F() in Case()
-------------------------------------+-------------------------------------
Reporter: Jonathan Souza | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: 2.2
(models, ORM) |
Severity: Normal | Resolution: duplicate
Keywords: F() Case() None != | Triage Stage:
None | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):
* status: new => closed
* resolution: => duplicate
Old description:
> Problems when comparing two fields in an annotate.
>
> when = ~Q(**{ 'name' :
> F('order_process__name') })
>
> annotate = {
> 'has_name_divergence': Case(
> When(when, then=True),
> default=False,
> output_field=CharField(),
> ),
> }
>
> When both fields have None value, the case result is true.
> None != None
> Using postgresSQL
New description:
Problems when comparing two fields in an annotate.
{{{
when = ~Q(**{ 'name' :
F('order_process__name') })
annotate = {
'has_name_divergence': Case(
When(when, then=True),
default=False,
output_field=CharField(),
),
}
}}}
When both fields have None value, the case result is true.
`None != None`
Using postgresSQL
--
Comment:
Duplicate of #29291.
> `None != None`. Using PostgreSQL.
`NULL` is not comparable.
--
Ticket URL: <https://code.djangoproject.com/ticket/32882#comment:1>
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/066.790bef0761c9602787e3e8e984d12a5c%40djangoproject.com.