mirror of
https://github.com/postgres/postgres.git
synced 2025-10-16 17:07:43 +03:00
pg_upgrade: Upgrade sequence data via pg_dump
Previously, pg_upgrade migrated sequence data like tables by copying the on-disk file. This does not allow any changes in the on-disk format for sequences. It's simpler to just have pg_dump set the new sequence values as it normally does. To do that, create a hidden submode in pg_dump that dumps sequence data even when a schema-only dump is requested, and trigger that submode in binary upgrade mode. (This new submode could easily be exposed as a command-line option, but it has limited use outside of pg_dump and would probably cause some confusion, so we don't do that at this time.) Reviewed-by: Anastasia Lubennikova <a.lubennikova@postgrespro.ru> Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
This commit is contained in:
@@ -171,6 +171,7 @@ dumpOptionsFromRestoreOptions(RestoreOptions *ropt)
|
||||
dopt->lockWaitTimeout = ropt->lockWaitTimeout;
|
||||
dopt->include_everything = ropt->include_everything;
|
||||
dopt->enable_row_security = ropt->enable_row_security;
|
||||
dopt->sequence_data = ropt->sequence_data;
|
||||
|
||||
return dopt;
|
||||
}
|
||||
@@ -2855,7 +2856,10 @@ _tocEntryRequired(TocEntry *te, teSection curSection, RestoreOptions *ropt)
|
||||
|
||||
/* Mask it if we only want schema */
|
||||
if (ropt->schemaOnly)
|
||||
res = res & REQ_SCHEMA;
|
||||
{
|
||||
if (!(ropt->sequence_data && strcmp(te->desc, "SEQUENCE SET") == 0))
|
||||
res = res & REQ_SCHEMA;
|
||||
}
|
||||
|
||||
/* Mask it if we only want data */
|
||||
if (ropt->dataOnly)
|
||||
|
Reference in New Issue
Block a user