Dump ALTER TABLE ... ATTACH PARTITION as a separate ArchiveEntry.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 12 Jan 2021 02:09:03 +0000 (21:09 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 12 Jan 2021 02:09:18 +0000 (21:09 -0500)
commit9a4c0e36fbd671b5e7426a5a0670bdd7ba2714a0
treed4f88d8c46dd0b752914cbd440a454446388bace
parentd5ab79d815783fe60062cefc423b54e82fbb92ff
Dump ALTER TABLE ... ATTACH PARTITION as a separate ArchiveEntry.

Previously, we emitted the ATTACH PARTITION command as part of
the child table's ArchiveEntry.  This was a poor choice since it
complicates restoring the partition as a standalone table; you have
to ignore the error from the ATTACH, which isn't even an option when
restoring direct-to-database with pg_restore.  (pg_restore will issue
the whole ArchiveEntry as one PQexec, so that any error rolls back
the table creation as well.)  Hence, separate it out as its own
ArchiveEntry, as indeed we already did for index ATTACH PARTITION
commands.

Justin Pryzby

Discussion: http://postgr.es/m/20201023052940.GE9241@telsasoft.com
src/bin/pg_dump/common.c
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.h
src/bin/pg_dump/pg_dump_sort.c