Re: Cleaning text with function?

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: "Patrick Hatcher" <PHatcher(at)macys(dot)com>, pgsql-novice(at)postgresql(dot)org
Subject: Re: Cleaning text with function?
Date: 2002-09-25 16:21:51
Message-ID: web-1660288@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Patrick,

> Currently I have a perl script that I use to cleanse text fields in a
> file
> for use in our mainframe. I would like to do this as a function and
> bypass
> using perl if possible. Is this possible? I do not have plperl
> installed
> on the database due to server restrictions.
> Example of current perl statement:

I'm afraid that you really need PL/Perl or PL/Tcl for this.

While it would be possible to do the text replacement with PL/pgSQL or
pglibq, it would be much, much slower -- basically, you'd need to loop
through the text character-by-character and test each character for the
correct types. If you want an example of this approach, search the
archives of the SQL list for the STRIPNUMERIC function which I posted
some time ago.

Perl and Tcl are known for their superior text-processing capabilities
for a reason.

-Josh Berkus

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2002-09-25 16:39:38 Re: pgcrypto?
Previous Message Juliet May 2002-09-25 15:55:32 Re: Question about cygwin/Postgre