v2_pg_dump_ignore_notinteresting_sequence.patch

application/octet-stream

Filename: v2_pg_dump_ignore_notinteresting_sequence.patch
Type: application/octet-stream
Part: 0
Message: Re: pg_dump crash on identity sequence with not loaded attributes

Patch

Format: unified
Series: patch v2
File+
src/bin/pg_dump/pg_dump.c 4 3
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index ec0cdf4ed7..c7465da33e 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -7253,10 +7253,11 @@ getOwnedSeqs(Archive *fout, TableInfo tblinfo[], int numTables)
 					 seqinfo->owning_tab, seqinfo->dobj.catId.oid);
 
 		/*
-		 * Only dump identity sequences if we're going to dump the table that
-		 * it belongs to.
+		 * Only dump identity sequences if we're going to dump the definition
+		 * of the table that it belongs to.  We ignore other components of the
+		 * sequence.
 		 */
-		if (owning_tab->dobj.dump == DUMP_COMPONENT_NONE &&
+		if (!(owning_tab->dobj.dump == DUMP_COMPONENT_DEFINITION) &&
 			seqinfo->is_identity_sequence)
 		{
 			seqinfo->dobj.dump = DUMP_COMPONENT_NONE;