How to remove non-breaking spaces from a column in Postgres

5.4k Views Asked by At

Trying to remove a non-breaking space from a field without any success. I've tried

execute <<-SQL
  UPDATE customers
  SET name = TRIM (name)
SQL

but this removes only spaces. It's similar question as this but I need it for Postgres (Postgres complains syntax error at or near "x00A0") and also I need only trimming i.e it has to remove only at the beginning and at the end of the text.

Thanks

1

There are 1 best solutions below

0
On BEST ANSWER

You can pass the character as the second argument of trim():

update customers
set name = trim(name, chr(160))