1

I have a table with large amount of 'S wrongly added and I want to replace it for 's:

I have tried with replace(field, ''S', ''s') but obviously doesn't accept it for the ', I also tried with the $$'$$ but still doesn't work.

The current version of PostgreSQL is 11 I have look into different threads and tried the solution there but didn't recognize i.e.

Replace apostrophe in string

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
gcj
  • 280
  • 2
  • 12

1 Answers1

3

The quote is the escape character for quotes as well. So you need one more quote for each string: replace(field, '''S', '''s')

clemens
  • 16,716
  • 11
  • 50
  • 65