[SQL] Converting a plperlu function to a plpgsql function

2004-07-22 Thread Devin Whalen
Hello, I am trying to convert a database function that is written in perl to a PL/pgSQL function. However, there a a couple of lines that I don't think can be converted. First line: my @active_tables=split(/,/,$tables); Is there anyway to split a variable like the perl split above? Second

Re: [SQL] Converting a plperlu function to a plpgsql function

2004-07-22 Thread Joe Conway
Devin Whalen wrote: First line: my @active_tables=split(/,/,$tables); Is there anyway to split a variable like the perl split above? I'm no perl guru, but in 7.4 I believe this does what you're looking for: regression=# select string_to_array('1,2,3',','); string_to_array -

Re: [SQL] Converting a plperlu function to a plpgsql function

2004-07-22 Thread Jeff Eckermann
--- Joe Conway [EMAIL PROTECTED] wrote: Devin Whalen wrote: First line: my @active_tables=split(/,/,$tables); Is there anyway to split a variable like the perl split above? I'm no perl guru, but in 7.4 I believe this does what you're looking for: regression=# select

Re: [SQL] Converting a plperlu function to a plpgsql function

2004-07-22 Thread Tom Lane
Jeff Eckermann [EMAIL PROTECTED] writes: Second line: if ($r=~/^-([0-9]?)([A-z_]+)/) { my $locid = $1; my $table = $2; PostgreSQL doesn't offer capturing parentheses. Hm? See the substring function: regression=# select substring('foobar' from 'o(.)a'); substring ---