work phone: 517.367.3099 work phone extension: 23099
From: Jan Lentfer [mailto:Jan.Lentfer@web.de] Sent: Tuesday, May 26, 2015 5:41 PM To: David G. Johnston Cc: Rossi, Maria; pgsql-admin@postgresql.org Subject: Re: [ADMIN] refreshing a database with pg_dump and psql
I have a database that was created from a ‘pg_dump –C’. No problems there. Then I ran the pg_dump again, this time without the –C. and tried to load it. But got a bunch of ‘object already exist’.
Can’t I refresh an existing database from a plain pg_dump? Is there an option that I have to use?
Thanks.
Check the pg_restore manual. There is a "clean" option when using the custom format. I think this is what you are looking for.
Or just inject a "DROP DATABASE ..." into the equation somewhere.