From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Jeevan Ladhe <jeevan.ladhe@enterprisedb.com>
Cc: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
Cc: amul sul <sulamul@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: Bug in pg_dump --table and --exclude-table for declarative partition table handling.
Date: Thu, 11 May 2017 09:33:27 -0400
Message-ID: <3928.1494509607@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+TgmoZ6btZ9xBuH2HUX8GOJnZqTuY6+bzdmRMxVgUe9REPamw@mail.gmail.com>
References: <CAAJ_b94bXL28PqXACEZfWQA0qfmmKrjB3FDhgQOOzFDyYzDVtA@mail.gmail.com>
<CAOgcT0N3JHJKcasd24_Zk-2rpf2Sk4LtTCVBgYoebPysTq-z8g@mail.gmail.com>
<CA+TgmoazyEb9mdL3yJkWRHHtcOFBzZDE_ESgq8iE22gPpdML-w@mail.gmail.com>
<14125.1494452121@sss.pgh.pa.us>
<CAFjFpRcVZX7ABrvQ0esbUg2KxyQaASc8HokjNGeg6Sk7boP8iA@mail.gmail.com>
<CAOgcT0PPxRsHMMhB0cZY=fC=O9y69tptH5PioHx64DPc9t14zA@mail.gmail.com>
<31399.1494507762@sss.pgh.pa.us>
<CA+TgmoZ6btZ9xBuH2HUX8GOJnZqTuY6+bzdmRMxVgUe9REPamw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Robert Haas <robertmhaas@gmail.com> writes:
> On Thu, May 11, 2017 at 9:02 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> You could argue that it would be better for pg_dump to emit something
>> like
>>
>> CREATE TABLE c (...);
>> ALTER TABLE c INHERIT p;
>>
>> so that if p isn't around, at least c gets created. And I think it
>> *would* be better, probably. But if that isn't a new feature then
>> I don't know what is. And partitioning really ought to track the
>> behavior of inheritance here.
> Hmm, I think that'd actually be worse, because it would break the use
> case where you want to restore the old contents of one particular
> inheritance child. So you drop that child (but not the parent or any
> other children) and then do a selective restore of that one child.
> Right now that works fine, but it'll fail with an error if we try to
> create the already-extant parent.
Uh ... what in that is creating the already-extant parent? What
I'm envisioning is simply that the TOC entry for the child table
contains those two statements rather than "CREATE TABLE c (...)
INHERITS (p)". The equivalent thing for the partitioned case is
to use a separate ATTACH PARTITION command rather than naming the
parent immediately in the child's CREATE TABLE. This is independent
of the question of how --table and friends ought to behave.
> I think one answer to the original complaint might be to add a new
> flag to pg_dump, something like --recursive-selection, maybe -r for
> short, which makes --table, --exclude-table, and --exclude-table-data
> cascade to inheritance descendents.
Yeah, you could do it like that. Another way to do it would be to
create variants of all the selection switches, along the lines of
"--table-all=foo" meaning "foo plus its children". Then you could
have some switches recursing and others not within the same command.
But maybe that's more flexibility than needed ... and I'm having a
hard time coming up with nice switch names, anyway.
Anyway, I'm still of the opinion that it's fine to leave this as a
future feature. If we've gotten away without it this long for
inherited tables, it's unlikely to be critical for partitioned tables.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, robertmhaas@gmail.com, jeevan.ladhe@enterprisedb.com, ashutosh.bapat@enterprisedb.com, sulamul@gmail.com
Subject: Re: Bug in pg_dump --table and --exclude-table for declarative partition table handling.
In-Reply-To: <3928.1494509607@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox