fix_generateSerialExtraStmts.patch

application/octet-stream

Filename: fix_generateSerialExtraStmts.patch
Type: application/octet-stream
Part: 0
Message: Re: BUG #17879: ERROR: unrecognized node type: 2139062143

Patch

Format: unified
File+
src/backend/parser/parse_utilcmd.c 6 2
diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c
index 15a1dab8c5..1bd19b4730 100644
--- a/src/backend/parser/parse_utilcmd.c
+++ b/src/backend/parser/parse_utilcmd.c
@@ -423,8 +423,12 @@ generateSerialExtraStmts(CreateStmtContext *cxt, ColumnDef *column,
 			snamespace = get_namespace_name(snamespaceid);
 		}
 		sname = rv->relname;
-		/* Remove the SEQUENCE NAME item from seqoptions */
-		seqoptions = list_delete_nth_cell(seqoptions, nameEl_idx);
+
+		/*
+		 * Remove the SEQUENCE NAME item from seqoptions.  We'd better make a
+		 * copy first so as we're not modifying the passed in List.
+		 */
+		seqoptions = list_delete_nth_cell(list_copy(seqoptions), nameEl_idx);
 	}
 	else
 	{