Re: Regex Query Index question

From: David Johnston <polobo(at)yahoo(dot)com>
To: David Johnston <polobo(at)yahoo(dot)com>
Cc: Naoko Reeves <naokoreeves(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Regex Query Index question
Date: 2011-08-12 00:02:45
Message-ID: C3753BF6-1182-4932-92EB-9392A26420A5@yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Now that I read more closely the alternation is actually concatenation. My point still stands but your issue is that you have not created a functional index on the decryption result of the encrypted phone number. PostgreSQL does not know that the decrypted phone number is equivalent to the unencrypted field. It only can look at expressions to determine whether an index is usable - not values. A table can have more than one index.

David J.

On Aug 11, 2011, at 19:58, David Johnston <polobo(at)yahoo(dot)com> wrote:

>
>>
>> Not testing here but... and ignore whitespace
>>
>> '^( [ \[\( ]? \s* \d{3} \s* [ -\s\]\) ] \d{3} [ -\s ] \d{4} )$'
>>
> Some tweaks needed but seriously consider dropping RegEx and going the functional index route.
>
>> '^( [ \[\( ]? \s* \d{3} \s* [ -\s\]\) ] \s* \d{3} \s* [ -\s ] \s* \d{4} )$'
>
> Added some extra white-space checking but again not tested.
>
> You can probably find better/more flexible expressions online.
>
> David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ondrej Ivanič 2011-08-12 00:30:08 Re: Postgres on SSD
Previous Message Rich Shepard 2011-08-12 00:00:32 Re: COPY from .csv File and Remove Duplicates