Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YxMbO-00036v-20 for pgsql-admin@arkaria.postgresql.org; Tue, 26 May 2015 21:41:34 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YxMbN-000139-Gq for pgsql-admin@arkaria.postgresql.org; Tue, 26 May 2015 21:41:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YxMbL-00010w-Jc for pgsql-admin@postgresql.org; Tue, 26 May 2015 21:41:31 +0000 Received: from mout.web.de ([212.227.17.11]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.84) (envelope-from ) id 1YxMbI-0007SS-3V for pgsql-admin@postgresql.org; Tue, 26 May 2015 21:41:30 +0000 Received: from vm-mailsrv.lan.net ([87.155.118.40]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0M9XUJ-1YqSBo040V-00CzNg; Tue, 26 May 2015 23:41:23 +0200 Received: from localhost (localhost [127.0.0.1]) by vm-mailsrv.lan.net (Postfix) with ESMTP id 52BB1F12E; Tue, 26 May 2015 23:41:23 +0200 (CEST) X-Spam-Flag: NO X-Spam-Score: -2.896 X-Spam-Level: X-Spam-Status: No, score=-2.896 tagged_above=-99.9 required=6.31 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, MIME_QP_LONG_LINE=0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no Received: from vm-mailsrv.lan.net ([127.0.0.1]) by localhost (vm-mailsrv.lan.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id raOOnZnSx1pP; Tue, 26 May 2015 23:41:17 +0200 (CEST) Received: from [10.94.76.50] (ipad.lan.net [10.94.76.50]) by vm-mailsrv.lan.net (Postfix) with ESMTP id A433BF12B; Tue, 26 May 2015 23:41:17 +0200 (CEST) Content-Type: multipart/alternative; boundary=Apple-Mail-D545AFAF-4FE9-4587-8F38-13BCC06C0309 Mime-Version: 1.0 (1.0) Subject: Re: refreshing a database with pg_dump and psql From: Jan Lentfer X-Mailer: iPad Mail (12D508) In-Reply-To: Date: Tue, 26 May 2015 23:41:15 +0200 Cc: "Rossi, Maria" , "pgsql-admin@postgresql.org" Content-Transfer-Encoding: 7bit Message-Id: <0DA2B66E-3916-4514-B4DD-7380622D930D@web.de> References: To: "David G. Johnston" X-Provags-ID: V03:K0:cGX7yyeqU/lkno4/uH8hqjCxNCOeqiYCdx1G2o8rrfxlQqygYQw suTvCAVb6J5T9ZX9SYOEERe94XW1XONrqMhNhaNw5UM5wT1g1f0174PqnfqRn/BvkHnw8X3 ZBdSzNr8k8e+4ysfNivVZnJYpWKPgAr6Bdi0Pn/iBG9uBSxH57J2YJtos7XR6qdLLQvn0TW ZyK2NSPyrE/ejdVXw1nkw== X-UI-Out-Filterresults: notjunk:1; X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org --Apple-Mail-D545AFAF-4FE9-4587-8F38-13BCC06C0309 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable > Am 26.05.2015 um 23:36 schrieb David G. Johnston : >=20 >> On Tue, May 26, 2015 at 2:27 PM, Jan Lentfer wrote: >=20 >>=20 >>> Am 26.05.2015 um 23:09 schrieb Rossi, Maria : >>>=20 >>> Hi, >>>=20 >>> =20 >>>=20 >>> I have a database that was created from a =E2=80=98pg_dump =E2=80=93C=E2= =80=99. No problems there. Then I ran the pg_dump again, this time witho= ut the =E2=80=93C. and tried to load it. But got a bunch of =E2=80=98obj= ect already exist=E2=80=99. =20 >>>=20 >>> Can=E2=80=99t I refresh an existing database from a plain pg_dump? Is t= here an option that I have to use? >>>=20 >>> Thanks. >>>=20 >>> =20 >>>=20 >> Check the pg_restore manual. There is a "clean" option when using the cus= tom format. I think this is what you are looking for. >>=20 >=20 > =E2=80=8BOr just inject a "DROP DATABASE ..." into the equation somewhere.= >=20 pg_restore -cC will do that, too. Jan= --Apple-Mail-D545AFAF-4FE9-4587-8F38-13BCC06C0309 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable


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

On Tue, M= ay 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.co= m>:

Hi,

 

I have a database that was created from a =E2=80=98pg= _dump =E2=80=93C=E2=80=99.  No problems there.  Then  I ran t= he pg_dump  again, this time without the =E2=80=93C. and tried to load i= t.   But   got a bunch of =E2=80=98object already exist=E2= =80=99.   

Can=E2=80=99t I refresh an existing database from a p= lain pg_dump?  Is  there an option that I have to use?

Thanks.

 

Check the pg_restore manual. There is a "clean" option w= hen using the custom format. I think this is what you are looking for.
<= br>

=E2=80=8BOr= just inject a "DROP DATABASE ..." into the equation somewhere.
<= div>
pg_restore -cC will do that, too.

Jan
<= /body>= --Apple-Mail-D545AFAF-4FE9-4587-8F38-13BCC06C0309--