Re: pg_dumping extensions having sequences with 9.6beta3

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: pg_dumping extensions having sequences with 9.6beta3
Дата
Msg-id CAB7nPqTSgdbaUSUUvY5=oHA7sGcS14kR3erdqRKOj2jPeozH-Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: pg_dumping extensions having sequences with 9.6beta3  (Stephen Frost <sfrost@snowman.net>)
Ответы Re: [HACKERS] pg_dumping extensions having sequences with 9.6beta3  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-general
On Wed, Jul 27, 2016 at 8:07 AM, Stephen Frost <sfrost@snowman.net> wrote:
> That'd be great.  It's definitely on my list of things to look into, but
> I'm extremely busy this week.  I hope to look into it on Friday, would
> be great to see what you find.

Sequences that are directly defined in extensions do not get dumped,
and sequences that are part of a serial column in an extension are
getting dumped. Looking into this problem, getOwnedSeqs() is visibly
doing an incorrect assumption: sequences owned by table columns are
dumped unconditionally, but this is not true for sequences that are
part of extensions. More precisely, dobj->dump is being enforced to
DUMP_COMPONENT_ALL, which makes the sequence definition to be dumped.
Oops.

The patch attached fixes the problem for me. I have added as well
tests in test_pg_dump in the shape of sequences defined in an
extension, and sequences that are part of a serial column. This patch
is also able to work in the case where a sequence is created as part
of a serial column, and gets removed after, say with ALTER EXTENSION
DROP SEQUENCE. The behavior for sequences and serial columns that are
not part of extensions is unchanged.

Stephen, it would be good if you could check the correctness of this
patch as you did all this refactoring of pg_dump to support catalog
ACLs. I am sure by the way that checking for (owning_tab->dobj.dump &&
DUMP_COMPONENT_DEFINITION) != 0 is not good because of for example the
case of a serial column created in an extension where the sequence is
dropped from the extension afterwards.
--
Michael

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Re: pg_dumping extensions having sequences with 9.6beta3
Следующее
От: Condor
Дата:
Сообщение: Re: Uber migrated from Postgres to MySQL