Passing function parameters to regexp_replace

Поиск
Список
Период
Сортировка
От Leif Biberg Kristensen
Тема Passing function parameters to regexp_replace
Дата
Msg-id 201109171321.43309.leif@solumslekt.org
обсуждение исходный текст
Ответы Re: Passing function parameters to regexp_replace  (Leif Biberg Kristensen <leif@solumslekt.org>)
Список pgsql-sql
I'm trying to write a sql or plpgsql function update_nametags(TEXT, TEXT) 
which does a replace on this form:

UPDATE sources SET source_text = regexp_replace(source_text, 
E'n="(.*?)$1(.*?)"', E'n="\\1$2\\2"', 'g') where source_text like 
'%n="%$2%">%';

But I can't find out how to escape the parameters $1 and $2. I've also tried to 
wrap it in an EXECUTE and concatenate the parameters with no luck.

I'd also like to have the function return the number of affected rows.

regards, Leif


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

Предыдущее
От: Tim Landscheidt
Дата:
Сообщение: Re: Window function sort order help
Следующее
От: Leif Biberg Kristensen
Дата:
Сообщение: Re: Passing function parameters to regexp_replace