On Sat, Mar 12, 2016 at 5:31 PM, David G. Johnston < david.g.johns...@gmail.com> wrote:
> 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. > > This seems like it is the main problem: # dropdb postgres # pg_restore --create <a dump with the postgres database> >No problems # pg_restore --clean --create <a dump with the postgres database> >public schema already exists So both --clean and --create are attempting to create the database. So in the example you can either use: # pg_restore --clean -d postgres or # pg_restore --create -d template1 But with the later you have to "dropdb" first - if the target database already exists With the former you have to "createdb" first - if the target database doesn't already exist. I agree the that exit code situation should be enhanced as well. David J.