Re: proper regex_replace() syntax

Поиск
Список
Период
Сортировка
От Rick Genter
Тема Re: proper regex_replace() syntax
Дата
Msg-id BANLkTi=JpyRDprQWcEj+Lmu=fR9_Car43Q@mail.gmail.com
обсуждение исходный текст
Ответ на proper regex_replace() syntax  (Geoffrey Myers <lists@serioustechnology.com>)
Список pgsql-general

On Wed, Jun 1, 2011 at 10:22 AM, Geoffrey Myers <lists@serioustechnology.com> wrote:
I want to use regex_replace() to replace characters in multiple records.

What I would like to do is this:

select regex_replace((select fname from table), 'z', 'Z'));


The problem is, the subquery returns more then one row.

So, is there a way to do what I'm trying to do?  That is, replace the same character in multiple records using regex_replace() ?

I think what you want is:

SELECT regex_replace(fname, 'z', 'Z') FROM table;

This should return a recordset where each row has one column which is the result of regex_replace() on the corresponding row of table.
-- 
Rick Genter
rick.genter@gmail.com

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

Предыдущее
От: Ken Tanzer
Дата:
Сообщение: Re: proper regex_replace() syntax
Следующее
От: "Paolo Saudin"
Дата:
Сообщение: SELECT to_timestamp crash PostgreSQL 9.1beta1