PostgreSQL UPDATE substring replacement PostgreSQL UPDATE substring replacement postgresql postgresql

PostgreSQL UPDATE substring replacement


If you want to replace all dollar signs, use this:

update test1    set name = replace(name, '$', '');

If you want to replace the $ only at the beginning of the value you can use substr() and a where clause to only change those rows where the column actually starts with a $

update test1     set name = substr(name, 2)where name like '$%';


To answer the question using the pattern the OP had in mind.

UPDATE test1 SET name=overlay(name placing '' from 1 for 1)WHERE name like '$%';