Russell Keith-Magee wrote:
> On 1/27/06, Robert Wittams <[EMAIL PROTECTED]> wrote:
> 
>>Russell Keith-Magee wrote:
>>
>>>2) I have a minor problem with the _set suffix: to me, _set implies
>>>uniqueness in the returned results, which will not exist unless
>>>.distinct()/distinct=True is used.
>>
>>Could you provide an example where you would actually end up with
>>duplicate results here? I'm having trouble thinking of how this would
>>actually occur. AFAICT, each child object will only show up once in the
>>results. If there is one, I agree that it would make sense to use
>>distinct by default.
> 
> 
> Any query involving joins over a m2o or m2m relation; if there are
> multiple matches in the related table, there will be multiple rows
> with the fields from the primary table: e.g.,
> 
> daily_planet = Newspaper.objects.get_object(name='Daily Planet')
> daily_planet.reporter_set.filter(article_headline__startswith="Foo")
> 
> will duplicate results for every reporter that has written more than
> one article with a headline starting with 'Foo'.

I agree we don't want this current behaviour. I had some hazy idea that
this got turned into group by malarkeys - obviously not...
Yes, I think distinct is the right way to go here.

Reply via email to