Re: Problem with index using regular expression

Поиск
Список
Период
Сортировка
От Håvard Wahl Kongsgård
Тема Re: Problem with index using regular expression
Дата
Msg-id BANLkTikEzZPMaCVGQ+wKzufxcsMYUoppgQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Problem with index using regular expression  (Alejandro Dubrovsky <alex.dubrovsky@hitwise.com>)
Список psycopg
Thanks, that solved it

On Mon, Jun 6, 2011 at 9:10 AM, Alejandro Dubrovsky <alex.dubrovsky@hitwise.com> wrote:
On 06/06/11 17:07, Federico Di Gregorio wrote:
> On 06/06/11 09:03, Håvard Wahl Kongsgård wrote:
>> substring(nodes.name <http://nodes.name> from
>> E'\\w.*\\s(\\w.*)$|\\w+\\s(\\w.*)$') = substring(income.name
>> <http://income.name> from E'\\w.*\\s(\\w.*)$|\\w+\\s(\\w.*)$') limit 1000")
>
> Try doubling every '\' because that's a Python escape character too and
> you want to send to the database the "\\X" sequence, not "\X"; i.e.,
>
> ... from E'\\\\w.*\\\\s(\\\\w.*)$|\\\\w+\\\\s(\\\\w.*)$') ...
>
It's easier to just put an r at the front of the string.
ie
r"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.*)$') limit 1000"




--
Sent via psycopg mailing list (psycopg@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/psycopg


В списке psycopg по дате отправления:

Предыдущее
От: Alejandro Dubrovsky
Дата:
Сообщение: Re: Problem with index using regular expression
Следующее
От: Federico Di Gregorio
Дата:
Сообщение: Re: 2.4.2 code ready