我已经使用pg_restore恢复了数据库。我发现数据已还原,但引发了一些错误。这些错误的原因是什么?
这是用于还原的命令
pg_restore -U postgres -d newdb08aug19 -j5远程
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 7616;
2606 36663585 FK CONSTRAINT card_history_cashcard_id_fk unify37
pg_restore: [archiver (db)] could not execute query: ERROR: relation "public.voucher" does not exist
Command was: ALTER TABLE ONLY finance.card_history
ADD CONSTRAINT card_history_cashcard_id_fk FOREIGN KEY (cashcard_id) REFERENCES pu...
pg_restore: [archiver (db)] Error from TOC entry 7614; 2606 36662489 FK CONSTRAINT card_history_coupon_id_fk unify37
pg_restore: [archiver (db)] could not execute query: ERROR: relation "public.cpn" does not exist
Command was: ALTER TABLE ONLY finance.card_history
ADD CONSTRAINT card_history_coupon_id_fk FOREIGN KEY (coupon_id) REFERENCES public...
pg_restore: [archiver (db)] Error from TOC entry 7615; 2606 36663406 FK CONSTRAINT card_history_domno_fk unify37
pg_restore: [archiver (db)] could not execute query: ERROR: relation "public.ssgdom" does not exist
Command was: ALTER TABLE ONLY finance.card_history
ADD CONSTRAINT card_history_domno_fk FOREIGN KEY (domno) REFERENCES public.ssgdom(...
这些错误的原因是什么?
答案 0 :(得分:0)
您仅转储了数据库的一部分(可能使用的是-n finance
之类的东西,它只会转储该模式中的对象)。
因此,转储中包含的引用表中不包含 的外键约束将导致错误消息。
除约束以外的所有内容都将正确还原。