A part of my database (PostgreSQL 9.3) relies on extra tables (ex. County, City, Town, … ). I don’t manage these tables, they are updated regularly by a third party. Each time I get a new full dump, but I have a hard time to push the changes back into my DB.
I’ve played with pg_dump / restore and run into some constraint issues duplicate key value violates unique constraint
or cannot drop constraint ... because other objects depend on it
even with --disable-triggers
or --clean
option.
Is there an option I’ve missed? I’ve found there are some ways to turn constraint on/off but I’ve no idea if it’s the good way to solve this or just a dirty hack? (I’m not a DBA expert.) To be honest, I’m quite surprised there isn’t an easy way to achieve this. Maybe I’ve missed it! I naively thought I could run pg_restore as a big transaction and check constraints at the end of the script. Is it possible?