Before v5, a question about the approach.
Making the comment depend on the child table instead fixes -n sp, but
brings back the original ordering failure: a parallel pg_restore -j 4
failed in 12 of 15 runs with 'constraint "nn_p" for table "child" does
not exist'. The comment needs the parent's constraint as a dependency
for the ordering, and in a selective restore _tocEntryRequired()
restores a COMMENT when any of its dependencies is selected, so I don't
see a way to get both right in pg_dump alone.
One option is for _tocEntryRequired() to also skip a COMMENT or
SECURITY LABEL whose own namespace is excluded by -n/-N. Would that be
acceptable, or is there a better way to do this within pg_dump?
Regards,
Sai Pranav