From: | Denis Papathanasiou <denis(dot)papathanasiou(at)banrai(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Using POSIX Regular Expressions on xml type fields gives inconsistent results |
Date: | 2012-12-21 15:42:50 |
Message-ID: | 50D4837A.2060704@banrai.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 12/21/2012 10:35 AM, David Johnston wrote:
>>
>> If you look at the four examples which follow the posix match table in the
>> docs (http://www.postgresql.org/docs/9.1/static/functions-
>> matching.html#FUNCTIONS-POSIX-TABLE),
>> some of them work from the left side, e.g.:
>>
>> 'abc' ~ '(b|d)' true
>>
>> In my original example, I found I could write this from left to right like
> this,
>> and it would still work:
>>
>> '(b|d)' ~ 'abc' true
>
> Really???
>
> Testing on Windows 9.0.4 this expression returns FALSE, not true as you
> claim. Please try again and reply with detailed version information and the
> exact query(s) used if you can get the behavior to repeat itself.
=> select id from form_d where '(kumar|gonzales)' ~* any(
CAST(xpath('//PersonsList/PersonName/LastName/text()', data) as TEXT[]) );
This expression returned (correctly) the information I wanted.
Shouldn't it *not* have worked b/c the '(kumar|gonzales)' regex is on
the left?
I was hoping to be able to use the xml type field to be able to do '^a'
type searches on names (e.g. a search for 'Fred' would also match
'Frederick', etc.) but since it seems that I cannot, I'll look at
different ways of solving this problem.
From | Date | Subject | |
---|---|---|---|
Next Message | jg | 2012-12-21 15:46:22 | Re: Coalesce bug ? |
Previous Message | jg | 2012-12-21 15:40:00 | Re: Coalesce bug ? |