I have a pg_dump backup which represents a slightly older version of a client dataset. A newer schema is running on the client's production environment, and there is not a readily available tool to convert the old schema into the newer one.
The only difference between the newer schema and the one represented in the backup is that some of the columns have been renamed, and a few of the types marked as varchar
have become text
instead.
I was hoping there'd be something like a "mapping file" that would instruct PostgreSQL to import the data and rename/retype the columns so as to wind up with the correct result, but I think I may have to resort to pgScript instead.
Does PostgreSQL offer a facility that would make this sort of restoration operation possible?
string
datatype. Do you meanvarchar
? Anyway: this doesn't make a ton of sense. If you restore a dump, you're generally going to be erasing the existing data anyway. So if you want to restore an old dataset you just do a DDL-and-data dump (the default) and restore with--clean
; this drops all existing tables and deletes all data then restores the new schema and data. – Craig Ringer Aug 11 '14 at 1:55varchar
, will correct. I think you misunderstood me, though: the application expects the new schema, not the old one. So merely reloading the old schema from the dump won't work; a transformation is required. – John Feminella Aug 11 '14 at 12:03