Last Updated: February 20, 2016
·
973
· tiwilliam

Use Slony-I to switch encoding online

What do you do when you have to switch encoding in PostgreSQL and at the same time have your database online for users?

1) Setup a new Slony cluster

http://slony.info/documentation/2.1/tutorial.html#FIRSTDB

2) Add your new empty server with UTF8 encoding storage

ALTER USER <slon-user> SET client_encoding TO 'LATIN1';

3) Start replicating and wait for all data to be transferred

http://slony.info/documentation/2.1/startingstopping.html

4) Switch master

http://slony.info/documentation/2.1/failover.html