From: | "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com> |
---|---|
To: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | regexp operator for array element compares needed |
Date: | 2012-04-12 18:50:04 |
Message-ID: | 0AD01C53605506449BA127FB8B99E5E10C36BBB7@FMSMSX105.amr.corp.intel.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Francois | 2012-04-12 20:39:48 | Re: Hot Standby - ERROR: canceling statement due to conflict with recovery |
Previous Message | Scott Marlowe | 2012-04-12 17:41:51 | Re: PGBouncer help (how to get it working) |