Re: Converting a plperlu function to a plpgsql function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Eckermann <jeff_eckermann(at)yahoo(dot)com>
Cc: devin(at)synapticvision(dot)com, pgsql-sql(at)postgresql(dot)org
Subject: Re: Converting a plperlu function to a plpgsql function
Date: 2004-07-22 20:34:05
Message-ID: 12272.1090528445@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Jeff Eckermann <jeff_eckermann(at)yahoo(dot)com> 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
-----------
b
(1 row)

You'd have to use it twice to collect two separate substrings, which is
mildly annoying, but it's hard to see how to do better without bizarre
behind-the-scenes stuff (like Perl's magic $n variables).

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Oeln 2004-07-22 22:45:52 Re: Issue with plpgsql trigger
Previous Message Devin Whalen 2004-07-22 19:18:25 Re: Converting a plperlu function to a plpgsql function