Search Postgresql Archives

regexp operator for array element compares needed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux