Using sed to convert hex characters in postgresql dump file
Posted
by
Bernt
on Server Fault
See other posts from Server Fault
or by Bernt
Published on 2010-09-13T09:01:30Z
Indexed on
2010/12/25
6:55 UTC
Read the original article
Hit count: 277
postgresql
|sed
I am working on moving several databases from a Postgresql 8.3 server to a Postgresql 8.4 server. It has worked fine so far, but one base has given me some trouble. The database is listed as unicode-encoded in the 8.3-server, but somehow a client program has managed to inject some invalid unicode data into it.
When I do a normal dump and restore using postgres' custom format, the new server won't accept it, complaining about unicode errors.
My plan is to do a plain text dump of the database, then use sed to replace the invalid characters with nothing (they are not needed). But how do you make sed work on hex/binary values in a file?
© Server Fault or respective owner