postgresql/src/bin/pg_dump
Stephen Frost bec96c82f8 Dump sequence data based on the TableDataInfo flag
When considering a sequence's Data entry in dumpSequenceData, we were
actually looking at the sequence definition's dump flag to decide if we
should dump the data or not.  That's generally fine, except for when the
sequence data entry was created by processExtensionTables() because it's
a config sequence.  In that case, the sequence itself won't be marked as
dumping data because it's part of an extension, leading to the need for
processExtensionTables() to create the sequence data entry.

This leads to extension config sequence data not being included in the
dump when it should be.  Fix this by looking at the sequence data's dump
flag instead, just as dumpTableData() was doing for tables (which is why
config tables were correctly being handled), and add a regression test
to make sure we don't break it moving forward.

All of this is a bit round-about since we can now represent which
components of a given dump item should be dumped out through the dump
flag.  A future improvement might be to change checkExtensionMembership()
to check for config sequences/tables and set the dump flag based on that
directly, possibly removing the need for processExtensionTables().

Bug found by Daniele Varrazzo.

Discussion: https://postgr.es/m/CA+mi_8ZmxQM7+nZ7pJ8uyfxc9V3o=UAG14dVqvftdmvw8OJ3gQ@mail.gmail.com

Patch by Michael Paquier, with some tweaking of the regression tests by
me.

Back-patch to 9.6 where the bug was introduced.
2017-01-19 12:06:21 -05:00
..
po Translation updates 2016-08-08 11:08:00 -04:00
t Add basic pg_dumpall/pg_restore TAP tests 2017-01-06 16:29:31 -05:00
.gitignore Clean up after pg_dump test runs. 2016-05-06 22:28:01 -04:00
common.c Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
compress_io.c Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
compress_io.h Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
dumputils.c Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
dumputils.h Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
Makefile Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
nls.mk Translation updates 2016-05-09 10:04:41 -04:00
parallel.c Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
parallel.h Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
pg_backup_archiver.c Improve pg_dump/pg_restore --create --if-exists logic. 2016-11-17 14:59:13 -05:00
pg_backup_archiver.h Re-pgindent src/bin/pg_dump/* 2016-11-17 14:36:59 -05:00
pg_backup_custom.c Rationalize parallel dump/restore's handling of worker cmd/status messages. 2016-09-27 13:56:04 -04:00
pg_backup_db.c Simplify correct use of simple_prompt(). 2016-08-30 17:02:02 -04:00
pg_backup_db.h Make pg_dump error cleanly with -j against hot standby 2016-05-26 22:14:23 +02:00
pg_backup_directory.c Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
pg_backup_null.c Create src/fe_utils/, and move stuff into there from pg_dump's dumputils. 2016-03-24 15:55:57 -04:00
pg_backup_tar.c Rationalize parallel dump/restore's handling of worker cmd/status messages. 2016-09-27 13:56:04 -04:00
pg_backup_tar.h Fix tar files emitted by pg_dump and pg_basebackup to be POSIX conformant. 2012-09-28 15:19:15 -04:00
pg_backup_utils.c Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
pg_backup_utils.h Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
pg_backup.h Add --no-blobs option to pg_dump 2016-11-29 11:09:35 -05:00
pg_dump_sort.c Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
pg_dump.c Dump sequence data based on the TableDataInfo flag 2017-01-19 12:06:21 -05:00
pg_dump.h Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
pg_dumpall.c Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
pg_restore.c pg_restore: Don't allow non-positive number of jobs 2017-01-11 15:45:50 -05:00