You can use regex_replace function to remove all special characters from a string in PostgreSQL database. Syntax is as shown below:
SELECT regexp_replace('string with special characters', '[^\w]+','','g');
Example:
SELECT regexp_replace('This - is%a $string', '[^\w]+','','g');
regex_replace
--------------
Thisisastring