PS_NITPICKS_20240710_SEQ_0002.txt

text/plain

Filename: PS_NITPICKS_20240710_SEQ_0002.txt
Type: text/plain
Part: 0
Message: Re: Logical Replication of sequences
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index f06584f..ead6299 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -10561,7 +10561,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
  *
  * CREATE PUBLICATION name [WITH options]
  *
- * CREATE PUBLICATION FOR ALL pub_obj_type [,...] [WITH options]
+ * CREATE PUBLICATION FOR ALL pub_obj_type [, ...] [WITH options]
  *
  * pub_obj_type is one of:
  *
@@ -10591,8 +10591,8 @@ CreatePublicationStmt:
 					CreatePublicationStmt *n = makeNode(CreatePublicationStmt);
 
 					n->pubname = $3;
-					n->options = $7;
 					preprocess_pub_all_objtype_list($6, &n->for_all_tables, &n->for_all_sequences, yyscanner);
+					n->options = $7;
 					$$ = (Node *) n;
 				}
 			| CREATE PUBLICATION name FOR pub_obj_list opt_definition
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index cdd6f11..ea7bb57 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -1866,19 +1866,20 @@ describeOneTableDetails(const char *schemaname,
 			result = PSQLexec(buf.data);
 			if (!result)
 				goto error_return;
-			else
-				tuples = PQntuples(result);
 
+			tuples = PQntuples(result);
+			/* Might be an empty set - that's ok */
 			if (tuples > 0)
+			{
 				printTableAddFooter(&cont, _("Publications:"));
 
-			/* Might be an empty set - that's ok */
-			for (i = 0; i < tuples; i++)
-			{
-				printfPQExpBuffer(&buf, "    \"%s\"",
-								  PQgetvalue(result, i, 0));
+				for (i = 0; i < tuples; i++)
+				{
+					printfPQExpBuffer(&buf, "    \"%s\"",
+									  PQgetvalue(result, i, 0));
 
-				printTableAddFooter(&cont, buf.data);
+					printTableAddFooter(&cont, buf.data);
+				}
 			}
 			PQclear(result);
 		}
@@ -6531,10 +6532,8 @@ describePublications(const char *pattern)
 
 		printTableAddCell(&cont, PQgetvalue(res, i, 2), false, false);
 		printTableAddCell(&cont, PQgetvalue(res, i, 3), false, false);
-
 		if (has_pubsequence)
 			printTableAddCell(&cont, PQgetvalue(res, i, 9), false, false);	/* all sequences */
-
 		printTableAddCell(&cont, PQgetvalue(res, i, 4), false, false);
 		printTableAddCell(&cont, PQgetvalue(res, i, 5), false, false);
 		printTableAddCell(&cont, PQgetvalue(res, i, 6), false, false);
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index 0f9a46a..798b034 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -4163,12 +4163,12 @@ typedef struct PublicationObjSpec
 } PublicationObjSpec;
 
 /*
- * All Publication type
+ * Publication types supported by FOR ALL ...
  */
 typedef enum PublicationAllObjType
 {
-	PUBLICATION_ALL_TABLES,		/* All tables */
-	PUBLICATION_ALL_SEQUENCES,	/* All sequences */
+	PUBLICATION_ALL_TABLES,
+	PUBLICATION_ALL_SEQUENCES,
 } PublicationAllObjType;
 
 typedef struct PublicationAllObjSpec