Re: String Translation

From: David Wheeler <david(at)kineticode(dot)com>
To: elein <elein(at)varlena(dot)com>
Cc: sfpug(at)postgresql(dot)org
Subject: Re: String Translation
Date: 2003-10-16 17:40:23
Message-ID: D1F26A6F-FFFF-11D7-9D1B-0003931A964A@kineticode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: sfpug

On Thursday, October 16, 2003, at 10:30 AM, elein wrote:

> The basic SQL is this:
>
> update <table>
> set <column>=fixident(<column>)
> where <column> = <column>;
>
> If the table were "contrib" and the column in question
> was "email", do:
>
> update contrib set email=fixident(email) where email=email;
>
> And where fixident(text) is the perl function
>
> create or replace function fixident (text)
> returns text as
> '
> my $data = $_[0];
> $data =~ y/a-z0-9/_/cs;
> return $data;
> ' language 'plperl';
>
> This should be faster. You don't need to fetch
> the value of the keyname before hand.

Yes, but unfortunately, I can't expect many Bricolage installs to have
PL/perl installed. I don't even have it installed, and I'm a Perl geek!

Thanks!

David

--
David Wheeler AIM: dwTheory
david(at)kineticode(dot)com ICQ: 15726394
http://www.kineticode.com/ Yahoo!: dew7e
Jabber: Theory(at)jabber(dot)org
Kineticode. Setting knowledge in motion.[sm]

In response to

Responses

Browse sfpug by date

  From Date Subject
Next Message Josh Berkus 2003-10-16 17:54:15 Re: String Translation
Previous Message David Wheeler 2003-10-16 17:39:05 Re: String Translation