Hi,
Wonder if someone can help.
I have a piece of code (filtched from elsewhere) that retrieves the
comments for a particular Entry (blog post):

Comment.objects.filter(content_type=ContentType.objects.get_for_model(Entry),
object_pk__in=Entry.objects.filter(title=self.title))

Problem is, that with Postgres 8.3 (and seemingly Django 1.2.1), this
command fails:

"
django.db.utils.DatabaseError: operator does not exist: text = integer
HINT:  No operator matches the given name and argument type(s). You
might need to add explicit type casts.
"

Having searched around in various forms this appears to be a sort of
known problem (see http://code.djangoproject.com/ticket/10015).

The issue is that object_py in Comments is a "text" field, whereas the
id field in Entry is an int - hence a cast is required. I can make the
actual SQL work in Postgres 8.3 by altering the start of the WHERE to
be:

"WHERE (cast(django_comments.object_pk as int) IN (SELECT" .... i.e.
adding the 'cast'.

So, my question is: what's the best way to go about this in Django
1.2.1 with Postgres 8.3? (8.3.8 to be exact). Any thoughts/
recommendations most welcome.

FYI - this is for use with Djapian.

Thanks,
R

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to