Re: regular expressions in query

Поиск
Список
Период
Сортировка
От Russ Brown
Тема Re: regular expressions in query
Дата
Msg-id 420F24A6.9060703@gmail.com
обсуждение исходный текст
Ответ на Re: regular expressions in query  (elein@varlena.com (elein))
Ответы Re: regular expressions in query  (Lincoln Yeoh <lyeoh@pop.jaring.my>)
Список pgsql-general
elein wrote:
> No doubt someone more adept at perl can write
> this function as a one-liner.
>
> create or replace function just_digits(text)
> returns text as
> $$
>         my $innum = $_[0];
>         $innum =~ s/\D//g;
>         return $innum;
> $$ language 'plperl'
>
>      SELECT telephone FROM addresses
>         WHERE user_id = 'bob'
>         AND just_digits(telephone) = '1115551212';
>
> --elein
>

I've  thought about things like this in the past, and a thought that
occurred to me was to add a functional index on just_digits(telephone)
to the table. Would this not allow the above query to use an index while
searching?

--

Russ.

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

Предыдущее
От:
Дата:
Сообщение: Re: problem with thai language==again
Следующее
От: Lincoln Yeoh
Дата:
Сообщение: Re: regular expressions in query