Home > Mobile >  Duplicate quotes in a postgres string
Duplicate quotes in a postgres string

Time:11-03

I have a function that generates a new user in the database. I would like to check if the email address contains any quotes and if it does, I would like to duplicate them.

For example, I have the following email address: test.o'[email protected] and I would like to transform it into test.o''[email protected].

Could anybody help me with this? Thank you

CodePudding user response:

Assuming you expect only one single quote (and not double or more), you could try using a simple replace:

UPDATE yourTable
SET email = REPLACE(email, '''', '''''');
  • Related