Search Postgresql Archives

Re: pg_restore fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Mar 12, 2016 at 5:31 PM, David G. Johnston <david.g.johnston@xxxxxxxxx> 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.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux