On 4/30/06, Cheng Zhang <[EMAIL PROTECTED]> 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?
I think this should be handled at the application level, because "id IN ()" could mean different things to different people. When I first saw your e-mail, I interpreted "id IN ()" as the empty set, but, now that I think about it, I could argue "id IN ()" is utterly meaningless, because a lookup of an ID in an empty list would still return all records. In short, it's up to the developer to be more explicit about what he/she wants. Adrian -- Adrian Holovaty holovaty.com | djangoproject.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---