Re: pg_dump 9.6 doesn't honour pg_extension_config_dump for sequences

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>, pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: pg_dump 9.6 doesn't honour pg_extension_config_dump for sequences
Date: 2017-01-19 07:47:47
Message-ID: CAB7nPqSqpvmoa5Rwk84sRnwu4vEfvUkCiG0UYkx5e=WEKeOz+Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Jan 18, 2017 at 11:45 PM, Stephen Frost <sfrost(at)snowman(dot)net> wrote:
> * Daniele Varrazzo (daniele(dot)varrazzo(at)gmail(dot)com) wrote:
>> On Wed, Jan 18, 2017 at 2:24 PM, Stephen Frost <sfrost(at)snowman(dot)net> wrote:
>> > * Daniele Varrazzo (daniele(dot)varrazzo(at)gmail(dot)com) wrote:
>> >> pg_extension_config_dump() doesn't appear working on sequences; the
>> >> resulting dump doesn't contain the state of the sequence. Tested on pg
>> >> 9.6.1 on Ubuntu. This seems a regression from pg 9.5.
>> >
>> > Thanks for the detailed bug report, I'll take a look at it.
>>
>> No problem. A detail maybe not clear (it's in the title, not in the
>> email): the error should be in pg_dump, not in the
>> pg_extension_config_dump() function, as I've found it using 9.6
>> pg_dump against a 9.5 database.
>
> Right, it's most likely something to do with the reworking of pg_dump
> that I did for 9.6.

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.
--
Michael

Attachment Content-Type Size
pgdump-seq-exts.patch invalid/octet-stream 2.1 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Вадим Акбашев 2017-01-19 09:11:59 Re: Strange influence of default_statistics_target
Previous Message Вадим Акбашев 2017-01-19 06:24:30 Re: Strange influence of default_statistics_target