Will pg_restore reload existing tables?

Let's say I have two host servers s1 and s2. On both servers I have a schema named n1, now I have made some changes to some tables represented in schema n1 from s1. I want the same change to be made to the n1 schema of the s2 server. what i am planning to do is backup the n1 schema of s1 using pg_dump and restore to s2 using pg_restore. Now my question is that server s2 already has the same schema n1 with the same set of tables. what will the recovery process do? will it replace existing tables or should I drop the existing s2 server schema and restore it with a dump from s1 server?

+3


source to share


1 answer


If you use the parameter --clean

pg_restore

, old tables will be dropped before new ones are created.



If you do not use the parameter --clean

, you will receive an error that the table already exists, but pg_restore

will continue processing if you do not use the parameter --exit-on-error

.

+8


source







All Articles