Re: Speeding up loops in pl/pgsql function

From: "Reuven M(dot) Lerner" <reuven(at)lerner(dot)co(dot)il>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
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-02 06:49:27
Message-ID: 4DE73277.9010308@lerner.co.il
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi, Merlin. You wrote:

> select string_agg(v, '') from (select
> ascii(regexp_split_to_table('abc', $$\s*$$))::text as v) q;
Wow. I've been programming with pl/pgsql for a good number of years,
but only now do I see the amazing usefulness of regexp_split_to_table
and string_agg, neither of which I really used until now. Thanks for
both the solution and for opening my eyes.
> (what about 3 digit ascii codes?)
I have to put the number into a text field anyway, so I've been
converting the resulting number to text, and then using lpad to add
leading zeroes as necessary.

Thanks again,

Reuven

--
Reuven M. Lerner -- Web development, consulting, and training
Mobile: +972-54-496-8405 * US phone: 847-230-9795
Skype/AIM: reuvenlerner

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Jenish 2011-06-02 13:39:35 Re: Strange behavior of child table.
Previous Message Jarrod Chesney 2011-06-02 01:46:38 Re: Delete performance