"David Johnston" writes:
>> while it might work to reverse the order in a regex, I have experienced
>> severe slowdown when the pattern comes from table data
> If it is indeed related to the custom reverse query the fact that you are
> going through an SQL wrapper to access a c-level function is
> >> There's a much easier fix to this problem though, which is to invent
> >> a "reverse ~" operator that does POSIX comparison with the pattern on
> >> the left. The hardest part of doing that for yourself is choosing a
> >> name for the reverse operator --- it just goes like
> >>
> >> create fu
>>
>> "David Johnston" writes:
>> > [optionally go look at " ~* " in the documentation at this point; or just
>> > try a simple flip-flop of the expression]
>>
>> > SELECT 'Kumar' ~* 'kuma' -> TRUE !!! (ah ha! I had the order reversed)
>>
>> > SELECT any( ARRAY['Kumar','Gozales']::text ) ... wa
Denis Papathanasiou writes:
> 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.
All regex operators in Postgres have the pattern on the right.
> -Original Message-
> From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-
> ow...@postgresql.org] On Behalf Of Denis Papathanasiou
> Sent: Friday, December 21, 2012 10:43 AM
> To: pgsql-general@postgresql.org
> Subject: Re: [GENERAL] Using POSIX Regular Expre
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 orig
>
> 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
] 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()
"David Johnston" writes:
> [optionally go look at " ~* " in the documentation at this point; or just
> try a simple flip-flop of the expression]
> SELECT 'Kumar' ~* 'kuma' -> TRUE !!! (ah ha! I had the order reversed)
> SELECT any( ARRAY['Kumar','Gozales']::text ) ... wait...ANY doesn't work on
> -Original Message-
> From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-
> ow...@postgresql.org] On Behalf Of Denis Papathanasiou
> Sent: Thursday, December 20, 2012 7:56 PM
> To: pgsql-general@postgresql.org
> Subject: [GENERAL] Using POSIX Regular Expre
>
> 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
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[]) );
id
--
97e1541b-27f
12 matches
Mail list logo