String REPLACE function

Поиск
Список
Период
Сортировка
От Joel Burton
Тема String REPLACE function
Дата
Msg-id Pine.LNX.4.21.0103220708370.28322-100000@olympus.scw.org
обсуждение исходный текст
Ответы Re: String REPLACE function
Список pgsql-sql
Is there a function for substring replacement?

There's translate(s, a, b), but that replaces all characters in a with
their corresponding character in b, eg.

  replace ('this is a cat', 'cat', 'dog') => ghis is o dog

I'm looking for a function that matches the whole string and replaces it:

  replace ('this is a cat', 'cat', 'dog') => this is a dog

I know I could write it in PL/PGSQL, but it seems that it would be very
inefficient. We're not using PL/perl or PL/tcl in this project, so I'd
rather not do it this way if it coulod be avoided.

Am I missing anything? Has anyone already solved this?

Thanks!

--
Joel Burton   <jburton@scw.org>
Director of Information Systems, Support Center of Washington


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Martin A. Marques"
Дата:
Сообщение: Re: CHAR or VARCHAR
Следующее
От: "Jack"
Дата:
Сообщение: Re: Re: psql win32 version