sql - In postgres how do i use the apostrophe character as a literal -
i trying convert instances of character ’ ', cant work how it.
this checks syntax okay isn't changing character
ubuntu@ip-172-31-39-147:~$ echo "update musicbrainz.release set name = translate(name,'’','’') name ~ '[’]+';"|psql jthinksearch update 7284
if dont escape ' fails:
ubuntu@ip-172-31-39-147:~$ echo "update musicbrainz.release set name = translate(name,'’',''') name ~ '[’]+';"|psql jthinksearch error: syntax error @ or near "[" line 1: ...ease set name = translate(name,'’',''') name ~ '[’]+';
and if escape it still fails different error
^ ubuntu@ip-172-31-39-147:~$ echo "update musicbrainz.release set name = translate(name,'’','\'') name ~ '[’]+';"|psql jthinksearch error: syntax error @ or near "[" line 1: ...ase set name = translate(name,'’','\'') name ~ '[’]+'; ^
i use replace()
:
update musicbrainz.release set name = replace(name, '’', '''') name '%’%';
to escape single quote, double up.
Comments
Post a Comment