| From: | Joel Burton <jburton(at)scw(dot)org> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org |
| Subject: | String REPLACE function |
| Date: | 2001-03-22 12:14:51 |
| Message-ID: | Pine.LNX.4.21.0103220708370.28322-100000@olympus.scw.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general 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(at)scw(dot)org>
Director of Information Systems, Support Center of Washington
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jonas Bengtsson | 2001-03-22 12:36:24 | OID as Primary Key |
| Previous Message | Feite Brekeveld | 2001-03-22 12:02:16 | Re: after trigger question |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Karel Zak | 2001-03-22 13:07:55 | Re: CHAR or VARCHAR |
| Previous Message | Martin A. Marques | 2001-03-22 11:05:19 | Re: CHAR or VARCHAR |