regexp operator for array element compares needed

Поиск
Список
Период
Сортировка
От Gauthier, Dave
Тема regexp operator for array element compares needed
Дата
Msg-id 0AD01C53605506449BA127FB8B99E5E10C36BBB7@FMSMSX105.amr.corp.intel.com
обсуждение исходный текст
Ответы Re: regexp operator for array element compares needed  (Sergey Konoplev <gray.ru@gmail.com>)
Список pgsql-general

Hi:

 

v8.3.4 on linux

 

In plpgsql, I have something like this...

 

if ((string_to_array(check_values_text,',') <@ string_to_array((select permitted_values from bi_constraints where bicolumn = 'fivr'),',')) = 'f')

    

It's just testing all the values in the check_values_text csv are in permitted_values csv (through array operators as you can see)

 

I need to do the same thing only for regexp.  

So, instead of...

 

if ((string_to_array('aa,cc,dx',',') <@ string_to_array((select permitted_values from 'aa,bb,cc,dd,ee' where bicolumn = 'fivr'),',')) = 'f')

(which would flag no compare because "dx" is not in 'aa,bb,cc,dd,ee')

I need to compare with regexp operator...

 

if ((string_to_array('aa,cc,dx',',') <@ string_to_array((select permitted_values from 'a.,b.,c*,d*,ee' where bicolumn = 'fivr'),',')) = 'f')

(which would compare OK because "dx" is is matched by "d*")

 

Don't even know if this sort of thing is possible.  I didn't see any operator like this in the docs.  May have to split out each and compare in nested loops sith atomic regexp compare "~".

 

Thanks for any ideas and/or help

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

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: PGBouncer help (how to get it working)
Следующее
От: Francois
Дата:
Сообщение: Re: Hot Standby - ERROR: canceling statement due to conflict with recovery