Comment 1 for bug 557326

Revision history for this message
xrg (xrg) wrote : Re: [Bug 557326] [NEW] Search for disctint values using the ORM

On Wednesday 07 April 2010, you wrote:
> Public bug reported:
>
> Answers for Question #106692 indicate that for the moment we can't do a
> "SELECT DISTINCT" using the ORM. There are cases where this would be
> useful (like searching the order ids in order lines), so I propose we add
> a new parameter "distinct=False" to the search() method of th OSVs. When
> set to True, it would return distinct tuples only.
> It seems easy to add in osv using a SELECT DISTINCT statement.
> It may be a bit more tricky in osv_memory, and it will run slower of
> course, and none sane will use it there I suppose, so we should just throw
> a "not implemented" exception I guess. Lionel
>

Aren't the orm.search() and orm.read() results already distinct, by definition?
Those functions use the id column as a key, and thus never expected to return
duplicate results.

Or am I missing something?