Re: pg_dump --data-only: is dump ordered to keep foreign-key-relations
От | Florian G. Pflug |
---|---|
Тема | Re: pg_dump --data-only: is dump ordered to keep foreign-key-relations |
Дата | |
Msg-id | 4386ED71.4050904@phlo.org обсуждение исходный текст |
Ответ на | Re: pg_dump --data-only: is dump ordered to keep foreign-key-relations loadable? (Harald Armin Massa <haraldarminmassa@gmail.com>) |
Список | pgsql-general |
Harald Armin Massa wrote: > - is pg_dump supposed to produce a "ordered dump" with --data-only? > (within documentation there is only a warning that --table will not dump > the depending ones) > [than I have to create a extract to reproduce that "bug"] > > - or if it is simply not implemented and an enhancement request; > (so I should file an enhancement-request and a "warning" -patch to the > pg_dump docu, that pg_dump --dataonly MUST be used with > --disable-trigger or similiar for backup-purposes) > > - or if it is even on a theoretical basis impossible to derive the > correct order. [circular foreign keys came to my mind] -> I also should > submit a patch to documentation Even _if_ it's theoretically possible, it would probably be too slow, i'd say. I'd be possible if you dependency-graph between your tables is acyclic - then simpily reordering the dump-order would be sufficient. But if you have some sort of cycle, you'd at least need to give up table-wise restoration, and instead e.g. restore 5 rows from t1, then 2 rows from t2, now 3 rows from _t1_ _again_. And if a _record_ some way depends on itself (So, the dependency graph between you _records_ even shows circles), then you'd sometimes need to insert a record, then insert a record that depends on the first, and then update the first record to now depend on the second. or something similar. And, with not-null contraints in place, this might be impossible without violating them :-(. So, I'd say you should either create backups using --disable-triggers, or use the custom-format - which let's you specify --disable-triggers, and a few other options at restore, rather then at backup time. greetings, Florian Pflug
В списке pgsql-general по дате отправления: