Re: Regular expressions and arrays and ANY() question

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Regular expressions and arrays and ANY() question
Дата
Msg-id 20070123074142.GB19527@svana.org
обсуждение исходный текст
Ответ на Re: Regular expressions and arrays and ANY() question  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Regular expressions and arrays and ANY() question  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On Tue, Jan 23, 2007 at 12:59:38AM -0500, Tom Lane wrote:
> >  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 ...

If you created such a function, and made an operator with it that was a
communtator of LIKE (call it "is liked by"), would the planner be smart
enough to split the ANY and commutate it to the normal order?

i.e. convert:

foo "is_liked_by" ANY( 'bar', 'baz')

to

'bar' like foo OR 'baz' like foo.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: [HACKERS] Autovacuum Improvements
Следующее
От: stevegy@126.com
Дата:
Сообщение: Re:   The jdbc