List Info

Thread: The count() function does not respect distinct() ?




The count() function does not respect distinct() ?
user name
2006-11-21 14:32:45
not like in the docs...
Or am I missing something?
The code:
TMergeDocsStatu.objects.values('p_name').filter(p_name__gt=&
quot;").distinct().order_by(sort_by)
gives me the filtered/distincted/ordered set as expected
(round 40
records).

TMergeDocsStatu.objects.values('p_name').filter(p_name__gt=&
quot;").distinct().order_by(sort_by).count()
returns 158 records.
This is the filtered but not distincted set.
Is this an error and if so, is there a work around?

Python 2.5, Django 0.95

thank you in advance,
robert


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

The count() function does not respect distinct() ?
user name
2006-11-23 02:41:48


On 11/21/06, soundseeker < soundseekergmx.de">soundseekergmx.de>; wrote:
This is the filtered but not distincted set.
Is this an error and if so, is there a work around?

It might be a bug; can you provide the result of calling _get_sql_clause() on each of these query sets?

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
&nbsp;You received this message because you are subscribed to the Google Groups "Django users"; group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to django-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

The count() function does not respect distinct() ?
user name
2006-11-23 10:21:07
(['"t_merge_docs_status"."fk_id"',
'"t_merge_docs_status"."doc_status"',
'"t_merge_docs_status"."tstamp"',
'"t_merge_docs_
status"."p_role"',
'"t_merge_docs_status"."p_name"',
'"t_merge_docs_status"."p_email"',
'"t_merge_docs_status"."id"', '"t_
merge_docs_status"."doc_next_action"'], '
FROM "t_merge_docs_status"
WHERE ("t_merge_docs_status"."p_name"
> %s) ORDER BY
"t_merge_docs_status"."p_name" ASC',
[''])

and

Exception Type:  	TypeError
Exception Value: 	'long' object is unsubscriptable
Exception Location:
	d:python25libsite-packagesDjango-0.95-py2.5.eggdjango
corepaginator.py
in get_page, line 35

robert


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

The count() function does not respect distinct() ?
user name
2006-11-23 10:25:10
upps,
the second should be (I think):
Exception Type:  	AttributeError
Exception Value: 	'long' object has no attribute
'_get_sql_clause'
Exception Location: 	D:merge..mergemerge_traceviews.py
in
show_editors, line 226


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )