Remove Characters from a String
Remove Characters from a String
August 26, 2025
I needed to remove an email from a string of emails in PostgreSQL. Below is what I came up with:
data> begin;
data> update progarm.emails set emails = replace(emails,' Marvin@mars.com;',''), comment = 'Remove Marvin from the group.' where name = 'looney';
data> commit;
Using replace() , I was able to remove Marvin.
If I wanted to update his email, then I would have done 'TheMartian@mars.com'
instead of ''
.