In postgresql, how do I replace all instances of a string within a database column?
Say I want to replace all instances of cat with dog, fo
cat
dog
Here is an example that replaces all instances of 1 or more white space characters in a column with an underscore using regular expression -
select distinct on (pd) regexp_replace(rndc.pd, '\\s+', '_','g') as pd from rndc14_ndc_mstr rndc;