Cheng Zhang wrote:

>I tried lookup like Article.objects.filter(id__in = []), which will  
>have SQL statement whose where clause is something like 'WHERE  
>("poll_article"."id" IN ())'. Such SQL statement is ok with SQLite  
>but invalid for PostgreSQL.
>
>I work around this problem with code like:
>if len(id_list) > 0:
>   Article.objects.filter(id__in = id_list)
>else:
>   Article.objects.filter(id__isnull = True)
>
>Should this problem be deal with on the Django framework level,  
>instead of application level?
>  
>
It shouldn't. Because in defferent situations people need different 
things when the list in the condition is empty. Empty list can mean 
"don't filter, get everything" or "equals to nothing so get empty list". 
And with your workaround user can get some arbitrary set of records 
where the field value happens to be NULL.

So this really should be handled manually.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to