Re: pg_dump, ATTACH, and independently restorable child partitions

Justin Pryzby <pryzby@telsasoft.com>

From: Justin Pryzby <pryzby@telsasoft.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>, David Rowley <drowley@postgresql.org>, pgsql-hackers@lists.postgresql.org
Date: 2020-12-02T22:50:13Z
Lists: pgsql-hackers

Attachments

On Wed, Nov 25, 2020 at 06:35:19PM -0500, Tom Lane wrote:
> Justin Pryzby <pryzby@telsasoft.com> writes:
> > 1. Maybe pg_restore ExecuteSqlCommandBuf() should (always?) call
> > ExecuteSimpleCommands() instead of ExecuteSqlCommand().  It doesn't seem to
> > break anything (although that surprised me).
> 
> That certainly does break everything, which I imagine is the reason
> why the cfbot shows that this patch is failing the pg_upgrade tests.

Thanks for looking, I have tried this.

> What we'd need to do if we want this to work with direct-to-DB restore
> is to split off the ATTACH PARTITION command as a separate TOC entry.
> That doesn't seem amazingly difficult, and it would even offer the
> possibility that you could extract the partition standalone without
> having to ignore errors.  (You'd use -l/-L to select the CREATE TABLE,
> the data, etc, but not the ATTACH object.)


-- 
Justin

Commits

  1. pg_dump: label INDEX ATTACH ArchiveEntries with an owner.

  2. Dump ALTER TABLE ... ATTACH PARTITION as a separate ArchiveEntry.

  3. Make pg_dump emit ATTACH PARTITION instead of PARTITION OF (reprise)