有没有办法让 pg_dump 排除特定序列?

2024-01-03

我想从 pg_dump 命令中排除一个序列,该命令将输出放入普通文件中。

Command: /Library/PostgreSQL/8.4/bin/pg_dump --host localhost --port 5433 --username xxx --format plain --clean --inserts --verbose --file /Users/xxx/documents/output/SYSTEM_admin_20131126015325.sql --exclude-table public.table1 --exclude-table public.table2 mydatabase

我知道上面使用的表有一些开关,您可以结合 pg_restore 启用/禁用 tar 格式的数据库对象,如pg_dump 文档 http://www.postgresql.org/docs/8.4/static/app-pgdump.html但我不会使用 pg_restore。

非常感谢

Graham


有两种情况:

  1. 要排除的顺序是由表拥有你也在倾销(典型情况:SERIAL柱子)。
    See: 在 postgres 中转储没有序列表的表 https://stackoverflow.com/questions/20141518/dump-a-table-without-sequence-table-in-postgres
    简短的回答:不,顺序不能被抛在一边。

  2. 顺序是不拥有通过一张废弃的桌子。然后它可以被排除--exclude-table开关就好像它是一张桌子一样。

来自 pg_dump 文档:

-T表 --排除表=表

Do not dump any tables matching the table pattern.

该模式根据与 -t 相同的规则进行解释

还有关于-t:

-t table
--表=表

Dump only tables (or views or sequences or foreign tables) matching table
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

有没有办法让 pg_dump 排除特定序列? 的相关文章

随机推荐