From: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
---|---|
To: | "Reuven M(dot) Lerner" <reuven(at)lerner(dot)co(dot)il> |
Cc: | Steve Crawford <scrawford(at)pinpointresearch(dot)com>, Alex Hunsaker <badalex(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Speeding up loops in pl/pgsql function |
Date: | 2011-06-01 13:26:30 |
Message-ID: | BANLkTi=EaBDsoS3V+rr=8ThzG_t9kVdBWA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
On Wed, Jun 1, 2011 at 4:19 AM, Reuven M. Lerner <reuven(at)lerner(dot)co(dot)il> wrote:
> 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.)
select string_agg(v, '') from (select
ascii(regexp_split_to_table('abc', $$\s*$$))::text as v) q;
(what about 3 digit ascii codes?)
merlin
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Davis | 2011-06-01 18:53:42 | Re: Strange behavior of child table. |
Previous Message | panam | 2011-06-01 12:40:55 | Re: [PERFORM] Hash Anti Join performance degradation |