Replace function BUG

Started by Nicolas Bottarinialmost 22 years ago4 messagesbugs
Jump to latest
#1Nicolas Bottarini
nicolas@avatarla.com

In postgreSQL 7.3.2 when I execute the following query

select replace('test %400% result', 'result', 'ok');

it returns "test % ok"

And If I Execute:

select replace('test %%400%% result', 'result', 'ok');

it returns the correct result: "test %400% ok"

If this is a known BUG please tell me because I need to fix this.

Thanks

Nicolas Bottarini

#2Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: Nicolas Bottarini (#1)
Re: Replace function BUG

On Tue, 13 Jul 2004, Nicolas Bottarini wrote:

In postgreSQL 7.3.2 when I execute the following query

select replace('test %400% result', 'result', 'ok');

it returns "test % ok"

I think this was fixed in the 7.4 branch.

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Stephan Szabo (#2)
Re: Replace function BUG

Stephan Szabo <sszabo@megazone.bigpanda.com> writes:

On Tue, 13 Jul 2004, Nicolas Bottarini wrote:

In postgreSQL 7.3.2 when I execute the following query

select replace('test %400% result', 'result', 'ok');

it returns "test % ok"

I think this was fixed in the 7.4 branch.

It was fixed in 7.3 branch as well:

2003-04-23 14:19 tgl

* src/backend/utils/adt/varlena.c (REL7_3_STABLE): Fix misbehavior
of replace() on strings containing '%'. Will patch separately but
equivalently in HEAD.

regards, tom lane

#4Theodore Petrosky
tedpet5@yahoo.com
In reply to: Nicolas Bottarini (#1)
Re: Replace function BUG

7.4.2 gives it like this:

testbed=# select replace('test %%400%% result',
'result', 'ok');
replace
-----------------
test %%400%% ok
(1 row)

testbed =# select replace('test %400% result',
'result', 'ok');
replace
---------------
test %400% ok
(1 row)

Ted

-- Nicolas Bottarini <nicolas@avatarla.com> wrote:

In postgreSQL 7.3.2 when I execute the following
query

select replace('test %400% result', 'result', 'ok');

it returns "test % ok"

And If I Execute:

select replace('test %%400%% result', 'result',
'ok');

it returns the correct result: "test %400% ok"

If this is a known BUG please tell me because I need
to fix this.

Thanks

Nicolas Bottarini

__________________________________
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/yahoo/votelifeengine/