Changes between Initial Version and Version 3 of Ticket #28560
- Timestamp:
- Sep 2, 2017, 2:53:25 PM (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #28560
- Property Summary distinct() on None values → distinct() on ordered queryset with restricted list of columns returns incorrect result
-
Ticket #28560 – Description
initial v3 1 `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`): 2 3 {{{ 4 >>> list(Item.objects.filter(modified__isnull=True).values_list('modified', flat=True).distinct()) 5 [None, None, None] 6 }}} 7 8 instead of `[None]`. 1 I think we should raise `NotSupportedError` when `distinct()` is used with `values()` (or `values_list()`) on ordered queryset and a list of fields in `values()` doesn't contain all fields from `ORDER BY`. It cannot return correct result because columns from `ORDER BY` clause must be included in `SELECT`.