Re: workaround for lack of REPLACE() function

From: Joe Conway <mail(at)joeconway(dot)com>
To: Agent155 Support <matt(at)planetnet(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: workaround for lack of REPLACE() function
Date: 2002-07-11 16:44:34
Message-ID: 3D2DB5F2.9050108@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-patches

Tom Lane wrote:
> "Agent155 Support" <matt(at)planetnet(dot)com> writes:
>
>>What do folks usually do when they have to do a global search/replace on a =
>>big table?
>
>
> You can code pretty much any text transformation you'd like in plperl or
> pltcl, both of which languages are very strong on string manipulations.
> So there's not been a lot of concern about the lack of a SQL-level
> substitution operator.
>
> IIRC, SQL99 does specify some sort of substring replacement function,
> and Thomas recently implemented it for 7.3. But it's not very bright
> and I suspect people will keep falling back on plperl or pltcl to do
> anything nontrivial.
>

I think Thomas did just recently commit the SQL99 OVERLAY function, but
similar to Tom's comment, I don't like the way SQL99 defines it. I've
written a replace() C function (along with a couple of other string
manipulation functions) for my own use. If you'd like a copy let me know
and I'll gladly send it to you.

I have thought about sending it in as a contrib, but wasn't sure if
there was enough interest to warrant it.

Joe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joe Conway 2002-07-11 16:50:07 Re: Linux max on shared buffers?
Previous Message Joshua D. Drake 2002-07-11 16:39:48 Re: about middleware over postgreSQL....

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-07-11 16:46:06 Re: Should this require CASCADE?
Previous Message Groff, Dana 2002-07-11 16:43:18 Re: Should this require CASCADE?

Browse pgsql-patches by date

  From Date Subject
Next Message Thomas Lockhart 2002-07-11 17:38:17 Re: workaround for lack of REPLACE() function
Previous Message Bruce Momjian 2002-07-11 16:20:45 Re: implementing query timeout