Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have two postgres databases.

Master = master_database Slave = database

All initial changes are made to master. Upon admin approval, the version is updated, and I want all changes to be copied to slave. I looked into using octupos, rubyrep, etc. but I don't want an automatic replication.

I'd like to add a rake task that is executed only when the version is updated.

I've tried using pg_dump and pg_restore, but I get error messages saying that:

ERROR: relation "whatever" already exists ~ OR ~ ERROR: multiple primary keys for table "whatevers" are not allowed

share|improve this question
    
You could use pg_restore with --clean, but it'll drop all the tables before re-creating them so you'll want to be sure there's no important data there. –  Craig Ringer Jul 4 at 0:46
    
@CraigRinger Thanks! This was exactly what I needed. I'm replicating the entire database, so I have no concern for losing data. –  user2168130 Jul 7 at 18:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.