Re: pg_dump, ATTACH, and independently restorable child partitions - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pg_dump, ATTACH, and independently restorable child partitions
Date
Msg-id 1094034.1610418498@sss.pgh.pa.us
Whole thread Raw
In response to Re: pg_dump, ATTACH, and independently restorable child partitions  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Justin Pryzby <pryzby@telsasoft.com> writes:
> [ v5-0001-pg_dump-output-separate-object-for-ALTER-TABLE.AT.patch ]

Pushed with mostly cosmetic edits.

One thing I changed that isn't cosmetic is that I set the ArchiveEntry's
owner to be the owner of the child table.  Although we aren't going to
do any sort of ALTER OWNER on this, it's still important that the owner
be marked as someone who has the right permissions to issue the ALTER.
The default case is that the original user will issue the ATTACH, which
basically only works if you run the restore as superuser.  It looks to
me like you copied this decision from the INDEX ATTACH code, which is
just as broken --- I'm going to go fix/backpatch that momentarily.

Another thing that bothers me still is that it's not real clear that
this code plays nicely with selective dumps, because it's not doing
anything to set the dobj.dump field in a non-default way (which in
turn means that the dobj.dump test in dumpTableAttach can never fire).
It seems like it might be possible to emit a TABLE ATTACH object
even though one or both of the referenced tables didn't get dumped.
In some desultory testing I couldn't get that to actually happen, but
maybe I just didn't push on it in the right way.  I'd be happier about
this if we set the flags with something along the lines of

    attachinfo->dobj.dump = attachinfo->parentTbl->dobj.dump &
                attachinfo->partitionTbl->dobj.dump;

            regards, tom lane



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Moving other hex functions to /common
Next
From: "tsunakawa.takay@fujitsu.com"
Date:
Subject: RE: POC: postgres_fdw insert batching