简体   繁体   English

分区表数据未使用 PostgreSQL 中的 pg_restore 恢复

[英]Partition table data are not restored using pg_restore in PostgreSQL

Need Help !!需要帮忙 !!

While i'm going to restore a partition table using:虽然我要使用以下方法恢复分区表:

pg_restore -U (username) -d (Database) -p (port_number) -t (partition_table) -f (filename)

the result is success but the data in that partition table is not restored, can anyone help me?结果是成功但该分区表中的数据没有恢复,有人可以帮我吗?

When -t is specified, pg_restore makes no attempt to dump any other database objects that the selected table(s) might depend upon.当指定 -t 时,pg_restore 不会尝试转储所选表可能依赖的任何其他数据库对象。 Therefore, there is no guarantee that the results of a specific-partitioned table dump can be successfully restored因此,不能保证特定分区表转储的结果可以成功恢复

However you can take dump using但是,您可以使用转储

pg_dump --host=hostname --username=user -t "child_table_*" --data-only --file=dump_out.sql dbname pg_dump --host=hostname --username=user -t "child_table_*" --data-only --file=dump_out.sql dbname

and then restore it, This is probably a consequence of the design decision to have partitions visible as individual tables on the SQL level.然后恢复它,这可能是设计决定将分区作为 SQL 级别上的单个表可见的结果。

please refer: https://www.postgresql.org/docs/13/app-pgrestore.html https://www.postgresql.org/docs/11/app-pgdump.html please refer: https://www.postgresql.org/docs/13/app-pgrestore.html https://www.postgresql.org/docs/11/app-pgdump.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM