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

From: Gilles Darold <gilles(at)migops(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Gilles Darold <gilles(at)migops(dot)com>
Cc: 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-03-05 08:03:33
Message-ID: 84edf9a5-c59c-2644-1ac8-7ac5b13f2891@migops.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Le 04/03/2023 à 19:18, Tom Lane a écrit :
> Gilles Darold <gilles(at)migops(dot)com> writes:
>> 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.
> I quite dislike the idea of a separate --with-whatever switch, because
> it will (presumably) apply to all of your --table and --exclude-table
> switches, where you may need it to apply to just some of them.
> Spelling considerations aside, attaching the property to the
> individual switches seems far superior. And I neither believe that
> this would add a lot of code, nor accept that as an excuse even if
> it's true.y..

Right, this is not a lot of code but just more code where I think we
just need a switch. I much prefer that it applies to all --table /
--exclude-table because this is generally the behavior we want for all
root/parent tables. But I agree that in some cases users could want that
this behavior applies to some selected tables only so the proposed new
options can answer to this need. Even if generally in similar cases
several pg_dump commands can be used. This is just my opinion, I will
adapt the patch to use the proposed new options.

But, what do you think about having pg_dump default to dump children
tables with --table / --exclude-table? I was very surprised that this
was not the case the first time I see that. In this case we could add
--[exclude-]table-no-child-tables. I think this form will be less used
than the form where we need the child tables to be dump with the parent
table, meaning that most of the time pg_dump commands using --table and
--exclude-table will be kept untouched and those using more regexp to
dump child tables could be simplified. I'm not sure that the backward
compatibility is an argument here to not change the default behavior of
pg_dump.

--

Gilles

--
Gilles Darold

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joel Jacobson 2023-03-05 08:53:32 Re: Missing free_var() at end of accum_sum_final()?
Previous Message Peter Smith 2023-03-05 07:52:19 Re: Deduplicate logicalrep_read_tuple()