Re: pg_restore fails - Mailing list pgsql-general

From Karsten Hilbert
Subject Re: pg_restore fails
Date
Msg-id 20160313004351.GF11080@hermes.hilbert.loc
Whole thread Raw
In response to Re: pg_restore fails  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: pg_restore fails  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-general
On Sat, Mar 12, 2016 at 05:31:38PM -0700, David G. Johnston wrote:

> > The reason being, of course, that I want to check the exit
> > code in a pg_restore wrapper script.
> >
> >
> I mistakenly thought public only came from template1...I wouldn't be
> opposed to that change.  This all seems awfully familiar too...
>
> You probably should just drop the existing database and use --create by
> itself.
>
> You can even use the dropdb command to avoid SQL in your script.

I already do something similar: the wrapper fails if the
target db exists before a restore is even attempted. The
restore itself now uses --create and works as expected. The
only thing left ATM is that I cannot distinguish
success-with-or-without-ignored-errors from real failure.

I _can_ partly work around that by attempting to connect to
the target and checking the md5 sum of the schema definition
against a known hash. That won't help with detecting whether
pg_restore thought that _data_ was successfully restored ...

Karsten
--
GPG key ID E4071346 @ eu.pool.sks-keyservers.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346


pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: pg_restore fails
Next
From: "David G. Johnston"
Date:
Subject: Re: pg_restore fails