On Mon, Sep 28, 2009 at 4:00 PM, janedenone <janeden...@googlemail.com>wrote:
> > Hi, > > this > > pages = Page.objects.exclude(content__iregex=r'^[\n\r \t]*<') > > should deliver the same rows as this > > SELECT ... FROM pages WHERE (content NOT REGEXP '^[\n\r \t]*<') > > but it does not: The Django query delivers 468 rows, whereas the SQL > query delivers 223. It could be that the Django query does not > recognize line endings as mentioned in the character class. Am I > missing something? > > The Django query is going to be an SQL query also. To see what Django is sending to the DB you should recreate in a shell session and then: >>> from django.db import connection >>> connection.queries[-1] to see how the query you are expecting compares to the query that is actually being issued. (Note the sql in connection.queries won't have the necessary quotes around the regexp parameter -- this quoting is done by the backend and therefore not logged in the version stored in connection.queries). Karen --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---