pg_dump – Handling Table Dependencies with –table Option

pg-dumppostgresql

The documentation says this when using -t table:

Note When -t is specified, pg_dump makes no attempt to dump any other
database objects that the selected table(s) might depend upon.
Therefore, there is no guarantee that the results of a specific-table
dump can be successfully restored by themselves into a clean database.

However, when the table has a sequence, and the owned by for the sequence is set to the table, it is included in the dump.

Shouldn't it be excluded according to this part of the documentation? (If so, why are sequences exceptions?)

What kind of database objects are going to be excluded in -t table mode then?

Best Answer

pg_dump -t will dump the definition of foreign key constraints. But will not dump the definition (or data) of the table which that constraint points to.

Similarly, if you have a check constraint which uses a function, the definition of the function will not get dumped.

I don't know the thought process behind dumping sequences. That does seem like a documentation bug.