Re: pg_dump --data-only problem with PgSQL 8.0

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: pg_dump --data-only problem with PgSQL 8.0
Дата
Msg-id 23557.1106592398@sss.pgh.pa.us
обсуждение исходный текст
Ответ на pg_dump --data-only problem with PgSQL 8.0  (Jani Averbach <jaa@jaa.iki.fi>)
Ответы Re: pg_dump --data-only problem with PgSQL 8.0  (Jani Averbach <jaa@jaa.iki.fi>)
Список pgsql-admin
Jani Averbach <jaa@jaa.iki.fi> writes:
> the following won't work:

> 4) Dump only data from just created 8.0 database:
>        pg_dump \
>             "--data-only" \
>             "--column-inserts" \
>             "--use-set-session-authorization" \
>             new_db > new_db.data-only.dump

> 5) Re-Create the new_db:
>        dropdb new_db; createdb new_db
>        CreateDBSchema.sh new_db

> 6) Try to reload data which was dumped from new ver 8.0 database:
>         psql new_db < new_db.data-only.dump

> This will fail with lots of these kinds of errors:
>          ERROR:  insert or update on table "mytable"
>          violates foreign key constraint "mytable_myattr_fkey"

Try it with --disable-triggers.

> Or have I found an ordering bug with pg_dump
> when you are doing "--data-only" dumps?

No.  pg_dump can't guarantee a safe order for loading data when there
are pre-existing foreign key constraints in place (since the constraints
could be circular, and it wouldn't necessarily know what they are anyway).
So it doesn't try.  You have to use --disable-triggers instead.

            regards, tom lane

В списке pgsql-admin по дате отправления:

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: pg_dump --data-only problem with PgSQL 8.0
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Trouble Escaping Quotes