pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephen Frost <sfrost@snowman.net>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: Daniele Varrazzo <daniele.varrazzo@gmail.com>
Cc: pgsql-bugs <pgsql-bugs@postgresql.org>
Subject: Re: pg_dump 9.6 doesn't honour pg_extension_config_dump for sequences
Date: Thu, 19 Jan 2017 08:46:40 -0500
Message-ID: <20170119134640.GN18360@tamriel.snowman.net> (raw)
In-Reply-To: <CAB7nPqSqpvmoa5Rwk84sRnwu4vEfvUkCiG0UYkx5e=WEKeOz+Q@mail.gmail.com>
References: <CA+mi_8ZmxQM7+nZ7pJ8uyfxc9V3o=UAG14dVqvftdmvw8OJ3gQ@mail.gmail.com>
	<20170118142443.GZ18360@tamriel.snowman.net>
	<CA+mi_8aV8-yyj6ZUpGF+G7Gkuevu6hPEZZQnpU=+Oia3eNSkUw@mail.gmail.com>
	<20170118144537.GA18360@tamriel.snowman.net>
	<CAB7nPqSqpvmoa5Rwk84sRnwu4vEfvUkCiG0UYkx5e=WEKeOz+Q@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Michael,

* Michael Paquier (michael.paquier@gmail.com) wrote:
> As far as I can see, the code path to dumpSequenceData() is taken
> correctly for such a sequence. processExtensionTables() creates a
> dataObj using makeTableDataInfo() only for sequences in extensions
> that are dumpable. So I have been wondering what's happening for some
> time, until I noticed that:

> --- a/src/bin/pg_dump/pg_dump.c
> +++ b/src/bin/pg_dump/pg_dump.c
> @@ -15671,7 +15671,7 @@ dumpSequenceData(Archive *fout, TableDataInfo *tdinfo)
>     appendPQExpBuffer(query, ", %s, %s);\n",
>                       last, (called ? "true" : "false"));
> 
> -   if (tbinfo->dobj.dump & DUMP_COMPONENT_DATA)
> +   if (tdinfo->dobj.dump & DUMP_COMPONENT_DATA)
>         ArchiveEntry(fout, nilCatalogId, createDumpId(),
>                      tbinfo->dobj.name,
>                      tbinfo->dobj.namespace->dobj.name,

> Not sure if I need to laugh or cry. Attached is a patch with the fix
> and new regression tests.

Yeah, that looks like the right answer and matches how dumpTableData
handles this, which is also why that's working correctly.

I don't particularly like this arrangement though.  This works because:

getTables() will create the entry for the sequence and call
selectDumpableTable(), which calls checkExtensionMembership(), which
will set the dump flags to ACL | SECLABEL | POLICY, and then
getTableData() will skip adding a data entry for it because DATA isn't
set, allowing processExtensionTables() to add the DATA entry later for
config tables/sequences.

Now that we've got the ability to indicate which pieces of a object
should be dumped, however, it seems like we could just check in
checkExtensionMembership() if it's a config table and set DATA then if
it is, possibly removing the need for processExtensionTables() entirely.

That's really future-work, but I wanted to mention my thoughts here in
case someone wants to work on it, or I might once I've cleared off the
other things on my plate.  For now, I'll go ahead and commit your
suggested fix, and thanks for including a new regression test to cover
this.

Thanks again!

Stephen

Attachments:

  signature.asc (application/pgp-signature, 818B) download

view thread (9+ messages)  latest in thread

Message-ID: <20170119134640.GN18360@tamriel.snowman.net>
Permalink:  ../20170119134640.GN18360@tamriel.snowman.net/
Also on:    postgresql.org/message-id/20170119134640.GN18360@tamriel.snowman.net

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: sfrost@snowman.net, michael.paquier@gmail.com, daniele.varrazzo@gmail.com
  Subject: Re: pg_dump 9.6 doesn't honour pg_extension_config_dump for sequences
  In-Reply-To: <20170119134640.GN18360@tamriel.snowman.net>
  References: <CA+mi_8ZmxQM7+nZ7pJ8uyfxc9V3o=UAG14dVqvftdmvw8OJ3gQ@mail.gmail.com> <20170118142443.GZ18360@tamriel.snowman.net> <CA+mi_8aV8-yyj6ZUpGF+G7Gkuevu6hPEZZQnpU=+Oia3eNSkUw@mail.gmail.com> <20170118144537.GA18360@tamriel.snowman.net> <CAB7nPqSqpvmoa5Rwk84sRnwu4vEfvUkCiG0UYkx5e=WEKeOz+Q@mail.gmail.com> <20170119134640.GN18360@tamriel.snowman.net>

* 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