Christopher B. Browne's Home Page

3.2. Database Schema Changes (DDL)

When changes are made to the database schema, e.g. - adding fields to a table, it is necessary for this to be handled rather carefully, otherwise different nodes may get rather deranged because they disagree on how particular tables are built.

If you pass the changes through Slony-I via SLONIK EXECUTE SCRIPT(7) (slonik), this allows you to be certain that the changes take effect at the same point in the transaction streams on all of the nodes. This may not be important to you depending on the nature of your change. You should still make sure that no transactions are changing the tables that your script uses while the EXECUTE SCRIPT command is running on the master.

It is essential to use EXECUTE SCRIPT if you alter the names of tables or the namespace they reside in. If you do not then Slony-I will be unaware of the new table name.

It's worth making a couple of comments on "special things" about SLONIK EXECUTE SCRIPT(7):

If slon; fails due to a failed DDL change then you should manually (via psql) make the required changes so that the DDL change succeeds the next time slon attempts it.

Contact me at