Re: Using POSIX Regular Expressions on xml type fields gives inconsistent results

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:24:54
Message-ID: 50D47F46.7060401@banrai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi David,

On 12/20/2012 08:48 PM, David Johnston wrote:
>> -----Original Message-----
>> From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-
>> owner(at)postgresql(dot)org] On Behalf Of Denis Papathanasiou
>> Sent: Thursday, December 20, 2012 7:56 PM
>> To: pgsql-general(at)postgresql(dot)org
>> Subject: [GENERAL] Using POSIX Regular Expressions on xml type fields
> gives
>> inconsistent results
[snip]
> [At this point I'd confirm or question why ANY hasn't been made to go both
> ways but also realize that I will have to approach this in a different way
> to achieve my goal.]

I did realize that ANY() must be a right-hand operator, but what I
didn't understand (and admittedly still don't understand) is why regex
operations that are normally right-side work from the left.

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

But when I reverse this expression:

'abc' ~ '^a' true

like this, it doesn't work:

'^a' ~ 'abc' false

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Johnston 2012-12-21 15:25:29 Re: Coalesce bug ?
Previous Message jg 2012-12-21 15:03:37 Coalesce bug ?