pg_dump/pg_restore schema and data separately and foreign key constraints

Поиск
Список
Период
Сортировка
От Vasiliy Vasin
Тема pg_dump/pg_restore schema and data separately and foreign key constraints
Дата
Msg-id 126571242157176@webmail17.yandex.ru
обсуждение исходный текст
Ответы Re: pg_dump/pg_restore schema and data separately and foreign key constraints  (Adrian Klaver <aklaver@comcast.net>)
Re: pg_dump/pg_restore schema and data separately and foreign key constraints  (Alan Hodgson <ahodgson@simkin.ca>)
Re: pg_dump/pg_restore schema and data separately and foreign key constraints  (Dragan Zubac <zubac@vlayko.tv>)
Список pgsql-general
I have database on production server that backups every day. Database is not big ~ 10mb.
But I added several tables that takes big capacity and I don't want to backup data from them.

So, I backup my database in two files: schema and data:
pg_dump -s -E utf-8 -f ${filename.schema} -F custom -n public -O -Z 9 -h ${connection.hostname} -U
${connection.username}${connection.database} 
pg_dump -a -T table1 -T table2-E utf-8 -f ${filename.data} -F custom -n public -O -Z 9 -h ${connection.hostname} -U
${connection.username}${connection.database} 

Then I tried to restore this backups:
pg_restore -s -d ${connection.database} -h ${connection.hostname} -U ${connection.username} -O -F custom
${schemaFileName}
pg_restore -a -d ${connection.database} -h ${connection.hostname} -U ${connection.username} -O -F custom
${dataFileName}

Schema backup restored successfully.

But then I restoring data backup I receiving errors like:
COPY failed: ERROR:  insert or update on table "sometable" violates foreign key constraint "bla-blah"

I tried -1 option for pg_restore, it not helps.

I think this is common problem, but I don't found answer in google, only questions... :(

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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Could not open file "pg_clog/...."
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: pg_dump/pg_restore schema and data separately and foreign key constraints