Is there a way to get pg_dump to exclude a specific sequence?

孤街醉人 提交于 2019-12-03 01:44:45
Daniel Vérité

There are two cases:

  1. The sequence to exclude is owned by a table you're also dumping (typical case: SERIAL column).
    See: Dump a table without sequence table in postgres
    Short answer: no, the sequence can't be left aside.

  2. The sequence is not owned by a dumped table. Then it can be excluded with the --exclude-table switch as if it was a table.

From pg_dump documentation:

-T table --exclude-table=table

Do not dump any tables matching the table pattern.

The pattern is interpreted according to the same rules as for -t

And about -t:

-t table
--table=table

Dump only tables (or views or sequences or foreign tables) matching table
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!