Opened 3 years ago

Closed 3 years ago

#32882 closed Bug (duplicate)

Problems when comparing two fields with None value using F() in Case() — at Version 1

Reported by: Jonathan Souza Owned by: nobody
Component: Database layer (models, ORM) Version: 2.2
Severity: Normal Keywords: F() Case() None != None
Cc: jnt.santos12@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Mariusz Felisiak)

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

Change History (1)

comment:1 by Mariusz Felisiak, 3 years ago

Description: modified (diff)
Resolution: duplicate
Status: newclosed

Duplicate of #29291.

None != None. Using PostgreSQL.

NULL is not comparable.

Note: See TracTickets for help on using tickets.
Back to Top