Re: pg_restore fails
От | David G. Johnston |
---|---|
Тема | Re: pg_restore fails |
Дата | |
Msg-id | CAKFQuwZe1AwGsndumnG2XZ-hP39q4mXLYAy=CDL37WvuY2Le9A@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: pg_restore fails ("David G. Johnston" <david.g.johnston@gmail.com>) |
Список | pgsql-general |
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.
В списке pgsql-general по дате отправления: