Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-sql by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group