Re: pg_dump doesn't dump new objects created in schemas from extensions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Martín Marqués <martin(at)2ndquadrant(dot)com>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: pg_dump doesn't dump new objects created in schemas from extensions
Date: 2016-06-22 14:32:47
Message-ID: 29478.1466605967@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

=?UTF-8?Q?Mart=c3=adn_Marqu=c3=a9s?= <martin(at)2ndquadrant(dot)com> writes:
> This is a new version of your patch that checks for schema inclusion or
> exclusion.

> If there are no complains, I could apply similar changes on other
> objects for a more complete patch.

> Thoughts, objections?

This patch seems to me to be entirely the wrong approach, as what it
will result in is an enormous amount of code duplication. There's
nothing fundamentally wrong with looking at the parent namespace to
decide whether to dump or not. The difficulty is that we need to draw
a distinction *at the namespace level* between "dump this namespace"
and "dump objects within this namespace". The correct behavior for
a namespace owned by an extension is to do the latter (for objects
not belonging to any extension) but not the former. So instead of
just one "dump" flag, we need two such flags for namespaces. The
various selectDumpableFoo routines need one-line adjustments as to
which flag they look at in the parent namespace. They do *not*
need copy-and-paste of their entire current contents.

In HEAD, this should be a pretty straightforward change since Stephen
Frost has already created infrastructure that allows distinguishing which
"components" of an object to dump. There doesn't seem to be a bit that
corresponds to "objects within this schema", but that shouldn't be hard
to add.

The DUMP_COMPONENT infrastructure doesn't exist in older branches
so I think you'd just have to invent an additional bool field in
NamespaceInfo structs to say whether to dump contained objects.

A slightly different approach is to ignore the DumpComponents stuff
and just add a bool field in NamespaceInfo for all branches. Perhaps
this would even be the right thing, as I may be misunderstanding what
Stephen intends the DumpComponents bits to be used for. Would be
interesting to hear Stephen's take on this.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Maxim Sobolev 2016-06-22 14:38:25 Re: BUG #14206: Switch to using POSIX semaphores on FreeBSD
Previous Message Stephen Frost 2016-06-22 13:42:45 Re: pg_dump doesn't dump new objects created in schemas from extensions