Re: [Proposal] Allow pg_dump to include all child tables with the root table - Mailing list pgsql-hackers

From Gilles Darold
Subject Re: [Proposal] Allow pg_dump to include all child tables with the root table
Date
Msg-id 04a4dcee-bd2c-8cc1-0f6f-704d2083f179@migops.com
Whole thread Raw
In response to Re: [Proposal] Allow pg_dump to include all child tables with the root table  (Stéphane Tachoires <stephane.tachoires@gmail.com>)
Responses Re: [Proposal] Allow pg_dump to include all child tables with the root table  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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.huang@highgo.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


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

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: meson: Optionally disable installation of test modules
Next
From: Andres Freund
Date:
Subject: Re: Weird failure with latches in curculio on v15