Re: Option to dump foreign data in pg_dump

From: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
To: David Steele <david(at)pgmasters(dot)net>
Cc: Luis Carril <luis(dot)carril(at)swarm64(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Daniel Gustafsson <daniel(at)yesql(dot)se>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Option to dump foreign data in pg_dump
Date: 2020-03-04 16:39:19
Message-ID: CAExHW5uR0_mNqxSX8xrFPiJqW7RMerPrd6LEZa=j3nu3n8gnmw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I am just responding on the latest mail on this thread. But the question is
about functionality. The proposal is to add a single flag
--include-foreign-data which controls whether or not data is dumped for all
the foreign tables in a database. That may not serve the purpose. A foreign
table may point to a view, materialized view or inheritance tree, and so
on. A database can have foreign tables pointing to all of those kinds.
Restoring data to a view won't be possible and restoring it into an
inheritance tree would insert it into the parent only and not the children.
Further, a user may not want the data to be dumped for all the foreign
tables since their usages are different esp. considering restore. I think a
better option is to extract data in a foreign table using --table if that's
the only usage. Otherwise, we need a foreign table level flag indicating
whether pg_dump should dump the data for that foreign table or not.

On Wed, Mar 4, 2020 at 12:41 AM David Steele <david(at)pgmasters(dot)net> wrote:

> Hi Luis,
>
> On 1/29/20 11:05 AM, Peter Eisentraut wrote:
> > On 2020-01-21 10:36, Luis Carril wrote:
> >>> Yes we can support --include-foreign-data without parallel option and
> >>> later add support for parallel option as a different patch.
> >>
> >> Hi,
> >>
> >> I've attached a new version of the patch in which an error is
> >> emitted if the parallel backup is used with the --include-foreign-data
> >> option.
> >
> > This seems like an overreaction. The whole point of
> > lockTableForWorker() is to avoid deadlocks, but foreign tables don't
> > have locks, so it's not a problem. I think you can just skip foreign
> > tables in lockTableForWorker() using the same logic that getTables()
> uses.
> >
> > I think parallel data dump would be an especially interesting option
> > when using foreign tables, so it's worth figuring this out.
>
> What do you think of Peter's comment?
>
> Regards,
> --
> -David
> david(at)pgmasters(dot)net
>
>
>

--
Best Wishes,
Ashutosh Bapat

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dmitry Dolgov 2020-03-04 17:03:39 Re: [HACKERS] [PATCH] Generic type subscripting
Previous Message Peter Eisentraut 2020-03-04 16:37:23 Re: HAVE_WORKING_LINK still needed?