Problem with index using regular expression - Mailing list psycopg

From Håvard Wahl Kongsgård
Subject Problem with index using regular expression
Date
Msg-id BANLkTi=2jJ8rAp-92==mzxpSABdHZ8vv+g@mail.gmail.com
Whole thread Raw
Responses Re: Problem with index using regular expression  (Federico Di Gregorio <federico.digregorio@dndg.it>)
List psycopg
Hi, with psycopg 2-2.4.1 I have some issue with incorrect use of indexes using regular expression.
I my case I have create on index on the surname of users. 
CREATE INDEX  income_surname ON income(substring(income.name from E'\\w.*\\s(\\w.*)$|\\w+\\s(\\w.*)$'))

then used
SELECT Distinct On (nodes.id) nodes.ID from nodes inner join income on substring(nodes.name from E'\\w.*\\s(\\w.*)$|\\w+\\s(\\w.*)$') = substring(income.name from E'\\w.*\\s(\\w.*)$|\\w+\\s(\\w.*)$')

with psql the index works fine, but with psycopg I don't think it's used at all. The index substring has to be identical with the substring in the query. Are there some encoding issues with psycopg?

--
Håvard Wahl Kongsgård

http://havard.security-review.net/

psycopg by date:

Previous
From: Daniele Varrazzo
Date:
Subject: Re: Installing via pip under Win7 + virtualenv + VC++2008
Next
From: Federico Di Gregorio
Date:
Subject: Re: Problem with index using regular expression