Thanks for the reply.
I'm actually trying to match a word boundary with "\\b" before and
after the string, not a backspace. Still one thing is unclear to me:
isn't the django API supposed to be portable across different database
platforms? Does iregex make an exception because of SQLite lack of reg-
exp support? If that's the case then the code has to be changed when
moving to production (that is, likely to a different database
platform)?

Thanks again
Francesco

On Nov 20, 12:58 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Mon, 2007-11-19 at 13:59 -0800, cesco wrote:
> > Sorry for the imprecise description of the problem.
>
> > After some filtering statements (which I don't show here) I derive a
> > qs containing about 1000 objects.
> > With the following statement I try to filter the query further
> > new_qs = qs.filter(models.Q(myField__iregex="\\b%s\\b" % myString)
> > and new_qs comes to have 93 objects.
> > This happens locally where I'm running sqlite3.
>
> > In the production server (which I currently can't access, so I can't
> > compare the sql statements) I have the same database (except that I'm
> > using Postgresql 8.2).
> > The qs which I have before the "critical" filter statement contains
> > the same objects (about 1000 of them). After I apply the same
> > filtering I get a resulting qs which is empty. So no error message or
> > infinite loop. Just a different unexpected result.
>
> Does the SQL produced by Django make sense for PostgreSQL? Once you know
> that it's likely to be an SQL selection problem, the next step is to
> look at the SQL generated and see if it's what you expect.
>
> The problem is almost certainly the '\b' in your regex, since that is
> trying to match "backspace" and I suspect you want '\m' in the first
> case and '\M' in the second one. SQLite doesn't have native regexp
> matching, so Django provides an interface to Python's regular expression
> module. However, this isn't the same as the reg-exp syntax used by
> PostgreSQL.
>
> Regards,
> Malcolm
>
> --
> I've got a mind like a... a... what's that thing 
> called?http://www.pointy-stick.com/blog/
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to