From: Reuven M. Lerner <reuven@lerner.co.il>
To: Alex Hunsaker <badalex@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Speeding up loops in pl/pgsql function
Date: Wed, 25 May 2011 21:45:43 +0300
Message-ID: <4DDD4E57.7070800@lerner.co.il> (raw)
In-Reply-To: <BANLkTinuiR=Txtn_dUeSbvvgcWZj9c2+iw@mail.gmail.com>
References: <4DDD358E.20307@lerner.co.il>
<BANLkTinuiR=Txtn_dUeSbvvgcWZj9c2+iw@mail.gmail.com>
Hi, Alex. You wrote:
> Have you tried something like:
> SELECT encode(regexp_replace('141142143', '(\d{3})', '\\\1',
> 'g')::bytea, 'escape');
Hmm, forgot about regexp_replace. It might do the trick, but without a
full-blown eval that I can run on the replacement side, it'll be a bit
more challenging. But that's a good direction to consider, for sure.
> I think select E'\XXX' is what you are looking for (per the fine
> manual: http://www.postgresql.org/docs/current/static/datatype-binary.html)
I didn't think that I could (easily) build a string like that from
digits in a variable or a column, but I'll poke around and see if it can
work.
Thanks,
Reuven
--
Reuven M. Lerner -- Web development, consulting, and training
Mobile: +972-54-496-8405 * US phone: 847-230-9795
Skype/AIM: reuvenlerner
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, badalex@gmail.com
Subject: Re: Speeding up loops in pl/pgsql function
In-Reply-To: <4DDD4E57.7070800@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