pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Reuven M. Lerner <reuven@lerner.co.il>
To: Merlin Moncure <mmoncure@gmail.com>
Cc: Steve Crawford <scrawford@pinpointresearch.com>
Cc: Alex Hunsaker <badalex@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Speeding up loops in pl/pgsql function
Date: Thu, 02 Jun 2011 09:49:27 +0300
Message-ID: <4DE73277.9010308@lerner.co.il> (raw)
In-Reply-To: <BANLkTi=EaBDsoS3V+rr=8ThzG_t9kVdBWA@mail.gmail.com>
References: <4DDD358E.20307@lerner.co.il>
	<BANLkTinuiR=Txtn_dUeSbvvgcWZj9c2+iw@mail.gmail.com>
	<4DDD4E57.7070800@lerner.co.il>
	<4DDD98B6.6080208@pinpointresearch.com>
	<BANLkTin8u2fM+RjE4Ao78v2W83V2Z9iHUA@mail.gmail.com>
	<BANLkTimU=O-vreTUTmC6TV+cA+TyqYqUnQ@mail.gmail.com>
	<BANLkTikoGpWS=S2EFruyWCkGxFoRk7Ms_A@mail.gmail.com>
	<4DE60422.3090800@lerner.co.il>
	<BANLkTi=EaBDsoS3V+rr=8ThzG_t9kVdBWA@mail.gmail.com>

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




view thread (18+ messages)

Message-ID: <4DE73277.9010308@lerner.co.il>
Permalink:  ../4DE73277.9010308@lerner.co.il/
Also on:    postgresql.org/message-id/4DE73277.9010308@lerner.co.il

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: reuven@lerner.co.il, mmoncure@gmail.com, scrawford@pinpointresearch.com, badalex@gmail.com
  Subject: Re: Speeding up loops in pl/pgsql function
  In-Reply-To: <4DE73277.9010308@lerner.co.il>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox