Обсуждение: Re: [SQL] Search and Replace

Поиск
Список
Период
Сортировка

Re: [SQL] Search and Replace

От
"Randy D. McCracken"
Дата:
On Thu, 9 Jan 2003, Ross J. Reedstrom wrote:

> On Thu, Jan 09, 2003 at 11:00:32AM +0530, Rajesh Kumar Mallah. wrote:
> >
> > any anyone explain whats wrong with the replace based solution to this problem
> > which i posted earlier?
> >
> > did i misunderstood anything?
>
> Probably just overkill - I'm sure it would work, but, based on how the
> question was asked, I guessed that the original questioner was looking
> for a quick, onetime fix sort of thing, and wasn't real comfortable with
> SQL, let alone adding contrib extension products to the installation.
>
> Ross
>
>

Hi Rajesh,

I don't know why but the example you gave me did not work.  Here is what
happened when I tried:

==========

pubs_test=# UPDATE publications SET url = replace( 'www.srs.fs.fed.us' ,
'www.srs.fs.usda.gov' , url )  WHERE url ilike '%www.srs.fs.fed.us%';

ERROR:  Function 'replace(unknown, unknown, text)' does not exist
        Unable to identify a function that satisfies the given argument types
        You may need to add explicit typecasts

==========

Obviously I am a newbie at PostgreSQL (I have also joined the Novice
mailing list to learn more) so I can not tell you why your example did not
work, perhaps someone else with more experience can add some information.

Best,

--rdm




Re: [SQL] Search and Replace

От
Bruno Wolff III
Дата:
On Thu, Jan 09, 2003 at 19:15:51 -0500,
  "Randy D. McCracken" <rdm@srs.fs.usda.gov> wrote:
>
> Hi Rajesh,
>
> I don't know why but the example you gave me did not work.  Here is what
> happened when I tried:
>
> ==========
>
> pubs_test=# UPDATE publications SET url = replace( 'www.srs.fs.fed.us' ,
> 'www.srs.fs.usda.gov' , url )  WHERE url ilike '%www.srs.fs.fed.us%';
>
> ERROR:  Function 'replace(unknown, unknown, text)' does not exist
>         Unable to identify a function that satisfies the given argument types
>         You may need to add explicit typecasts

The arguments to replace were in the wrong order.