Re: Is there a bug in queryset distinct() filtration in Postgre SQL?

2009-04-30 Thread Tyler Erickson
Malcolm, As you guessed, it was the default ordering that was causing the problem for me. After removing the default ordering from the model, distinct() works as expected. I still find it strange that distinct().count() was not affected by the model's default ordering, while the actual list of

Re: Is there a bug in queryset distinct() filtration in Postgre SQL?

2009-04-27 Thread NoviceSortOf
Thanks Malcom... Simply adding values() to the query with author and title to the search worked perfectly in limiting the SQL DISTINCT criteria to the relevant fields, Using... results = Titles.objects.values('author','title').filter(qset).order_by ().distinct() Django provides this elegant

Re: Is there a bug in queryset distinct() filtration in Postgre SQL?

2009-04-27 Thread Malcolm Tredinnick
On Mon, 2009-04-27 at 08:51 -0700, NoviceSortOf wrote: > > Thanks for the as_sql() function as can now can > see the SQL detail. Which reveals a problem in > getting DISTINCT to draw from a fields or fields that can in fact > return the unique result of the query. Perhaps it is my usage > of the

Re: Is there a bug in queryset distinct() filtration in Postgre SQL?

2009-04-27 Thread NoviceSortOf
Thanks for the as_sql() function as can now can see the SQL detail. Which reveals a problem in getting DISTINCT to draw from a fields or fields that can in fact return the unique result of the query. Perhaps it is my usage of the function so I'm listing an examble below. To further simplify my

Re: Is there a bug in queryset distinct() filtration in Postgre SQL?

2009-04-25 Thread Malcolm Tredinnick
On Thu, 2009-04-23 at 13:22 -0700, Tyler Erickson wrote: > I seem to be encountering the same or similar issue. The distinct() > method seems to have no affect on my queryset. Both this post and the original one don't contain enough information for anybody to replicate the problem (since we can

Re: Is there a bug in queryset distinct() filtration in Postgre SQL?

2009-04-23 Thread Tyler Erickson
Following up on my last post... After using distinct(), the count() is what I expect, but when I iterate through the queryset results there are more results that I expect, and the count of the queryset changes (see example below). -- def

Re: Is there a bug in queryset distinct() filtration in Postgre SQL?

2009-04-23 Thread Tyler Erickson
I seem to be encountering the same or similar issue. The distinct() method seems to have no affect on my queryset. I am using PostgreSQL, and the django.contrib.gis.db models object. ipdb> p TruckLog.objects.values('vehicleid') [{'vehicleid': 80533}, {'vehicleid': 80480}, {'vehicleid': 80437},

Is there a bug in queryset distinct() filtration in Postgre SQL?

2009-04-21 Thread NoviceSortOf
I've tried various permuations of filters and approaches in attempting to get unique/distinct results on a django query with postgres data to no avail. Using distinct() has no effect on queries in the following examples... qset= (Q(title__icontains='MOBY DICK')) results1 =