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

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: (view raw, whole thread or download thread mbox)
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!



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

In response to


sfpug by date

Next:From: Josh BerkusDate: 2003-10-16 17:54:15
Subject: Re: String Translation
Previous:From: David WheelerDate: 2003-10-16 17:39:05
Subject: Re: String Translation

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