Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 96C9BB62A52 for ; Wed, 1 Jun 2011 06:19:51 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 55053-05 for ; Wed, 1 Jun 2011 09:19:44 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from lerner.co.il (unknown [69.55.231.201]) by mail.postgresql.org (Postfix) with ESMTP id 6C82AB62A71 for ; Wed, 1 Jun 2011 06:19:44 -0300 (ADT) Received: by lerner.co.il (Postfix, from userid 1003) id 5EC395D6D48; Wed, 1 Jun 2011 12:19:42 +0300 (IDT) X-DKIM: Sendmail DKIM Filter v2.8.3 lerner.co.il 5EC395D6D48 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lerner.co.il; s=MAILOUT; t=1306919982; bh=niv9gOjs8/VZLGsv3LYDsePjQz7/5UKl+fsXI4o7XY8=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=XGRblNoQLboedtQWvd5/+txqgs1O3XOBni0c6DHu0zd2HODT1s6nVN2W+ymhT8rlF XuiKtbKqKlPcwPAdeWd86PRSyS7xkfNOcKwqp3gk71/lN8BWazznvc9iPtcmHeQJzQ Bz3QKhlCy6srsfcy++TEir2CSVwCEinboUYcO2Z8= Received: from 2-54-126-107.orange.net.il (unknown [2.54.126.107]) by lerner.co.il (Postfix) with ESMTPS id F07CE5D6673; Wed, 1 Jun 2011 12:19:35 +0300 (IDT) X-DKIM: Sendmail DKIM Filter v2.8.3 lerner.co.il F07CE5D6673 Message-ID: <4DE60422.3090800@lerner.co.il> Date: Wed, 01 Jun 2011 12:19:30 +0300 From: "Reuven M. Lerner" User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: Merlin Moncure CC: Steve Crawford , Alex Hunsaker , pgsql-performance@postgresql.org Subject: Re: Speeding up loops in pl/pgsql function References: <4DDD358E.20307@lerner.co.il> <4DDD4E57.7070800@lerner.co.il> <4DDD98B6.6080208@pinpointresearch.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.107 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RDNS_NONE=0.793 X-Spam-Level: X-Archive-Number: 201106/2 X-Sequence-Number: 43935 Hi, everyone. First of all, thanks for all of your help several days ago. The improvements to our program were rather dramatic (in a positive sense). Based on the help that everyone gave, I'm working on something similar, trying to use regexp_replace to transform a string into the result of invoking a function on each character. For example, I'd like to do the following: regexp_replace('abc', '(.)', ascii(E'\\1')::text, 'g'); Unfortunately, the above invokes ascii() on the literal string E'\\1', rather than on the value of the backreference, which isn't nearly as useful. I'd like to get '979899' back as a string. And of course, once I can get back the value of ascii(), I figure that it should work for any function that I define. Thanks again for any suggestions everyone might have. (And if this should go to pgsql-general, then I'll understand. If it helps, my alternative to regexp_replace is a super-slow function, akin to the one that I showed here last week.) Reuven