I'm trying to execute an UPDATE from a psql prompt. I want to change all instances of a country name from Cote d"Ivoire
to Cote d'Ivoire
(so the double quote becomes a single quote). My first attempt did nothing but change the psql prompt (notice the double quote between the database name and the pound character)...
database=# UPDATE address SET country = 'Cote d\'Ivoire' WHERE country = 'Cote D"Ivoire';
database"#
...so I escaped the double quote and got an error:
database=# UPDATE address SET country = 'Cote d\'Ivoire' WHERE country = 'Cote D\"Ivoire';
Invalid command \"Ivoire';. Try \? for help.
What am I doing wrong?
Update:
I used dollar-quoted string constants to achieve what I wanted:
database=# UPDATE address SET country = $$Cote d'Ivoire$$ WHERE country = $$Cote D"Ivoire$$;
UPDATE 22