Ability to do .distinct() on extra select columns
|Reported by:||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.5|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
It would be nice to be able to use columns defined in .extra ( select = ... ) as fields in .distinct (). As it is, SQLCompiler.get_distinct () ends up calling ._setup_joins () on all fields, which fails. SQLCompiler.get_ordering (), on the other hand seems to have a mechanism to cope with extra columns.
Currently I use a hacked custom SQLCompiler for this but it would be nice if I didn't have to.