Opened 8 years ago

Last modified 4 years ago

#28560 new Bug

distinct() on None values — at Initial Version

Reported by: Mariusz Felisiak Owned by: Mariusz Felisiak
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords: distinct values
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

distinct() doesn't work properly on None values. If we select columns with null values then distinct() returns each of them instead of single None, e.g. (based on queries/tests.py):

>>> list(Item.objects.filter(modified__isnull=True).values_list('modified', flat=True).distinct())
[None, None, None]

instead of [None].

According to the ticket's flags, the next step(s) to move this issue forward are:

  • To provide a patch by sending a pull request. Claim the ticket when you start working so that someone else doesn't duplicate effort. Before sending a pull request, review your work against the patch review checklist. Check the "Has patch" flag on the ticket after sending a pull request and include a link to the pull request in the ticket comment when making that update. The usual format is: [https://github.com/django/django/pull/#### PR].

Change History (0)

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