Re: Regular expressions and arrays and ANY() question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: webb(dot)sprague(at)gmail(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Regular expressions and arrays and ANY() question
Date: 2007-01-23 05:59:38
Message-ID: 10631.1169531978@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

webb(dot)sprague(at)gmail(dot)com writes:
> I am trying to figure out how to use a regex and an ANY(), without any
> luck, to determine if at least one element of an array (on the right)
> matches the given constant pattern (on the left).

> I think the problem is because the pattern expects to be on the right
> side with the target on the left, but I want to do it reversed.

Yeah, the ANY syntax only allows the array on the right. You'd have to
make a LIKE-ish operator that takes the pattern on the left ... it'd
take about two minutes to do this with a SQL or plpgsql function
underlying the operator, but such a function might not be fast enough
for you ...

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2007-01-23 06:18:49 Re: New US DST Rules & PostgreSQL
Previous Message Tom Lane 2007-01-23 05:45:50 Re: too many trigger records found for relation "item" - what's that about??