Re: regexp searching in arrays not working?

Поиск
Список
Период
Сортировка
От Rhys Stewart
Тема Re: regexp searching in arrays not working?
Дата
Msg-id 189966030706200525h47467332i43852a00d2c270ed@mail.gmail.com
обсуждение исходный текст
Ответ на Re: regexp searching in arrays not working?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
thats cool,

thanks.

2007/6/19, Tom Lane <tgl@sss.pgh.pa.us>:
"Rhys Stewart" <rhys.stewart@gmail.com> writes:
> Is regex searching not functioning (as i expect it to?)

~ expects the pattern on the right, not the left.  So it's taking your
array entries as patterns, which don't match the data 'Trans'.

Since there's no "(array) ANY op scalar" syntax, the only way to get
this to work is to make a reverse-pattern-match operator that takes
the pattern on the left.  You can glue one together from spare parts
easily enough:

regression=# create function reverse_regex(text,text) returns bool as
regression-# 'select $2 ~ $1' language sql immutable strict;
CREATE FUNCTION
regression=# create operator ~~~ (procedure = reverse_regex,
regression(# leftarg = text, rightarg = text);
CREATE OPERATOR

but I'm not sure what the performance will be like with a SQL function
in there...

                        regards, tom lane

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

Предыдущее
От: Enrico Sirola
Дата:
Сообщение: copying indexes and f.keys from a template table
Следующее
От: Francisco Reyes
Дата:
Сообщение: Re: pg_restore out of memory