Обсуждение: pg_restore tells schema “test” already exists but it isn't actually

Поиск
Список
Период
Сортировка

pg_restore tells schema “test” already exists but it isn't actually

От
Alex Luya
Дата:

When restoring a dump like this:

pg_restore --clean --create --exit-on-error --dbname=test test.tar

these error messages got printed out:

pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 21; 2615 80924 SCHEMA test test
pg_restore: [archiver (db)] could not execute query: ERROR:  schema "test" already exists
Command was: CREATE SCHEMA test;

but when:

select schema_name from information_schema.schemata;

these got printed out

schema_name     
--------------------
pg_toast
pg_temp_1
pg_toast_temp_1
pg_catalog
public
information_schema

It seems like schema "test" doesn't exist yet,why do I got this kind of error?


Re: [GENERAL] pg_restore tells schema “test” already exists but it isn't actually

От
Melvin Davidson
Дата:
Try this instead:
SELECT current_database();
SELECT nspname FROM pg_namespace ORDER BY 1;

Also, What is the exact command you are using with pg_restore?

On Thu, Nov 12, 2015 at 9:53 PM, Alex Luya <alexander.luya@gmail.com> wrote:

When restoring a dump like this:

pg_restore --clean --create --exit-on-error --dbname=test test.tar

these error messages got printed out:

pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 21; 2615 80924 SCHEMA test test
pg_restore: [archiver (db)] could not execute query: ERROR:  schema "test" already exists
Command was: CREATE SCHEMA test;

but when:

select schema_name from information_schema.schemata;

these got printed out

schema_name     
--------------------
pg_toast
pg_temp_1
pg_toast_temp_1
pg_catalog
public
information_schema

It seems like schema "test" doesn't exist yet,why do I got this kind of error?





--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.

Re: pg_restore tells schema “test” already exists but it isn't actually

От
Adrian Klaver
Дата:
On 11/12/2015 06:53 PM, Alex Luya wrote:
> When restoring a dump like this:
>
> |pg_restore --clean --create --exit-on-error --dbname=test test.tar|
>
> these error messages got printed out:
>
> |pg_restore:[archiver (db)]Error whilePROCESSING TOC:pg_restore:[archiver
> (db)]Error fromTOC entry 21;261580924SCHEMAtest test
> pg_restore:[archiver (db)]could
> notexecutequery:ERROR:schema"test"already existsCommand
> was:CREATESCHEMAtest;|
>
> but when:
>
> |selectschema_name frominformation_schema.schemata;|
>
> these got printed out
>
> |schema_name --------------------pg_toast pg_temp_1 pg_toast_temp_1
> pg_catalog publicinformation_schema|

What database are you running the above on?

What is the database you are trying to CREATE and does it already exist
when you run the restore?

What happens if you try without --exit-on-error?

>
> It seems like schema "test" doesn't exist yet,why do I got this kind of
> error?


>
>


--
Adrian Klaver
adrian.klaver@aklaver.com