Re: refreshing a database with pg_dump and psql - Mailing list pgsql-admin

From Jan Lentfer
Subject Re: refreshing a database with pg_dump and psql
Date
Msg-id 0DA2B66E-3916-4514-B4DD-7380622D930D@web.de
Whole thread Raw
In response to Re: refreshing a database with pg_dump and psql  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: refreshing a database with pg_dump and psql  ("Rossi, Maria" <maria.rossi@us.pgds.com>)
List pgsql-admin


Am 26.05.2015 um 23:36 schrieb David G. Johnston <david.g.johnston@gmail.com>:

On Tue, May 26, 2015 at 2:27 PM, Jan Lentfer <Jan.Lentfer@web.de> wrote:

Am 26.05.2015 um 23:09 schrieb Rossi, Maria <maria.rossi@us.pgds.com>:

Hi,

 

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.

pg_restore -cC will do that, too.

Jan

pgsql-admin by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: refreshing a database with pg_dump and psql
Next
From: "David G. Johnston"
Date:
Subject: Re: refreshing a database with pg_dump and psql