Skip site navigation (1) Skip section navigation (2)

Re: Speeding up loops in pl/pgsql function

From: Alex Hunsaker <badalex(at)gmail(dot)com>
To: "Reuven M(dot) Lerner" <reuven(at)lerner(dot)co(dot)il>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Speeding up loops in pl/pgsql function
Date: 2011-05-25 18:35:08
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
On Wed, May 25, 2011 at 10:59, Reuven M. Lerner <reuven(at)lerner(dot)co(dot)il> wrote:
> Hi, everyone.  I'm working on a project that's using PostgreSQL 8.3, that
> requires me to translate strings of octal digits into strings of characters
> -- so '141142143' should become 'abc', although the database column
> containing this data (both before and after) is a bytea.

Have you tried something like:
SELECT  encode(regexp_replace('141142143', '(\d{3})', '\\\1',
'g')::bytea, 'escape');

> ...
> Of course, any suggestions for how to deal with octal digits in PostgreSQL
> 8.3, such as an octal equivalent to the x'ff' syntax, would be more than
> welcome.

I think select E'\XXX' is what you are looking for (per the fine

In response to


pgsql-performance by date

Next:From: Reuven M. LernerDate: 2011-05-25 18:45:43
Subject: Re: Speeding up loops in pl/pgsql function
Previous:From: Kevin GrittnerDate: 2011-05-25 17:40:56
Subject: Re: Hash Anti Join performance degradation

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group