Problem with replace function in postgres

From: akp geek <akpgeek(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Problem with replace function in postgres
Date: 2010-11-23 20:05:09
Message-ID: AANLkTi=T8K6UrUebMJ94jvPYhjm0FPszVzkgqVKj0ctw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dear all -

I am having trouble with replace function inside a function.
If I do the same replace function outside it works fine, Following example
clearly explains my problem. Can you please help?

create table str_table
( mystr varchar(1000));
insert into str_table values ( 'This road is INDEFLY CLSD');

insert into str_table values('That is INDEFLY open');

insert into str_table values('That is a CLSD road');

select * from str_table;

create table lookup
( code varchar(100),
codeword varchar(100));

insert into lookup values( 'INDEFLY','indefinitely');

insert into lookup values( 'CLSD','closed');

select 'This road is INDEFLY CLSD', test_repl('This road is INDEFLY CLSD
INDEFLY') replaced_str
from str_table;

RESULT SET " This road is INDEFLY CLSD;This road is indefinitely closed
INDEFLY "

Regards

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2010-11-23 20:07:50 Re: Problem with replace function in postgres
Previous Message Matthew Walden 2010-11-23 18:00:55 Re: postmaster.pid does not exist. cannot start postgres server on ubuntu