urldb=# select replace('whateveritis','a','A');
replace
--------------
whAteveritis
(1 row)
urldb=# select replace('whateveritis','e','E');
replace
--------------
whatEvEritis
(1 row)
urldb=# select replace('whatever%20itis','e','E');
replace
---------------------------------
whatEvEr 1tis
(1 row)
urldb=# select replace('whatever%%20itis','e','E');
replace
-----------------
whatEvEr%20itis
(1 row)
urldb=# select replace('whatever%%20sitis','e','E');
replace
------------------
whatEvEr%20sitis
(1 row)
urldb=# select replace('whatever%20sitis','e','E');
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!#
> psql urldb
Welcome to psql 7.3.2, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit
urldb=# select replace('whatever%20sitis','si','SI');
replace
---------------
whateverSItis
(1 row)
1. No doc said % should escape by %%, and
select replace('whatever%20sites','%20','%%20') won't work also.
2. v7.3.2 haven't resolved this problem yet, I am not sure the later version.
Jie Liang