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

From: "David Johnston" <polobo(at)yahoo(dot)com>
To: "'Denis Papathanasiou'" <denis(dot)papathanasiou(at)banrai(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Using POSIX Regular Expressions on xml type fields gives inconsistent results
Date: 2012-12-21 01:14:23
Message-ID: 01b901cddf18$846d09c0$8d471d40$@yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>
> I have a table with an xml type column, and while I can make regex queries
> like this successfully:
>
> => select id from form_d where 'kumar' ~* any(
> CAST(xpath('//PersonsList/PersonName/LastName/text()', data) as TEXT[])
> );

It took me way too long to figure this out:

SELECT 'text to search against' ~* 'regular expression'

The text to be searched must be on the left-hand side of the operator and
thus the regular expression operators cannot be used with "ANY/ALL" because
they require that the text to be search exist on the right-hand side of the
operator.

I'll let others respond as to the difficulty of implementing a LHS-Array
version of ANY/ALL

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Johnston 2012-12-21 01:48:51 Re: Using POSIX Regular Expressions on xml type fields gives inconsistent results
Previous Message Denis Papathanasiou 2012-12-21 00:55:55 Using POSIX Regular Expressions on xml type fields gives inconsistent results