Opened 8 years ago
Last modified 5 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].
Note:
See TracTickets
for help on using tickets.