Re: [Proposal] Allow pg_dump to include all child tables with the root table

From: Gilles Darold <gilles(at)migops(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [Proposal] Allow pg_dump to include all child tables with the root table
Date: 2023-02-25 18:59:47
Message-ID: 04a4dcee-bd2c-8cc1-0f6f-704d2083f179@migops.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Le 25/02/2023 à 16:40, Stéphane Tachoires a écrit :
> Hi,
>
> I'm not sure about the "child" -> "partition" change as it also
> selects childs that are not partitions.
> I'm more dubious about the --with-childs option, I'd rather have
> --table-with-childs=<PATTERN> and
> --exclude-table-with-childs=<PATTERN>. That will be clearer about what
> is what.
>
> I'm working on that, but have a hard time with
> test pg_dump/002_pg_dump (It's brand new to me)
>
> Stéphane
>
> Le ven. 24 févr. 2023 à 23:50, Cary Huang <cary(dot)huang(at)highgo(dot)ca> a écrit :
>
> The following review has been posted through the commitfest
> application:
> make installcheck-world:  tested, passed
> Implements feature:       tested, passed
> Spec compliant:           not tested
> Documentation:            not tested
>
> Hi
>
> the patch applies fine on current master branch and it works as
> described. However, I would suggest changing the new option name
> from "--with-childs" to "--with-partitions" for several reasons.
>
> "childs" is grammatically incorrect and in the PG community, the
> term "partitioned table" is normally used to denote a parent
> table, and the term "partition" is used to denote the child table
> under the parent table. We should use these terms to stay
> consistent with the community.
>
> Also, I would rephrase the documentation as:
>
> Used in conjunction with
> <option>-t</option>/<option>--table</option> or
> <option>-T</option>/<option>--exclude-table</option> options to
> include or exclude partitions of the specified tables if any.
>
> thank you
>
> Cary Huang
> ================
> HighGo Software Canada
> www.highgo.ca <http://www.highgo.ca>
>

Hi,

This is right this patch also works with inherited tables so
--with-partitions can be confusing this is why --with-childs was chosen.
But I disagree the use of --table-with-childs and
--exclude-table-with-childs because we already have the --table and
--exclude-table, and it will add lot of code where we just need a switch
to include children tables. Actually my first though was that this
behavior (dump child tables when the root table is dumped using --table)
should be the default in pg_dump but the problem is that it could break
existing scripts using pg_dump so I prefer to implement the
--with-childs options.

I think we can use --with-partitions, provided that it is clear in the
documentation that this option also works with inheritance.

Attached is a new patch v2 using the --with-partitions and the
documentation fix.

--
Gilles Darold

Attachment Content-Type Size
0001-dump-with-child-v2.patch text/x-patch 11.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2023-02-25 19:00:31 Re: Weird failure with latches in curculio on v15
Previous Message Andres Freund 2023-02-25 18:36:12 Re: meson: Optionally disable installation of test modules