X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 509B5D1B1BE for ; Thu, 22 Jul 2004 17:34:13 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41946-03 for ; Thu, 22 Jul 2004 20:34:06 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 1326FD1B17B for ; Thu, 22 Jul 2004 17:34:03 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i6MKY5NM012273; Thu, 22 Jul 2004 16:34:05 -0400 (EDT) To: Jeff Eckermann Cc: devin@synapticvision.com, pgsql-sql@postgresql.org Subject: Re: Converting a plperlu function to a plpgsql function In-reply-to: <20040722190916.89900.qmail@web20824.mail.yahoo.com> References: <20040722190916.89900.qmail@web20824.mail.yahoo.com> Comments: In-reply-to Jeff Eckermann message dated "Thu, 22 Jul 2004 12:09:16 -0700" Date: Thu, 22 Jul 2004 16:34:05 -0400 Message-ID: <12272.1090528445@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200407/190 X-Sequence-Number: 18442 Jeff Eckermann 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