diff --git a/src/backend/replication/logical/tablesync.c b/src/backend/replication/logical/tablesync.c index bacf0fd..13c7fc7 100644 --- a/src/backend/replication/logical/tablesync.c +++ b/src/backend/replication/logical/tablesync.c @@ -701,13 +701,11 @@ make_copy_attnamelist(LogicalRepRelMapEntry *rel, bool *attgenlist) { List *attnamelist = NIL; List *gencollist = NIL; - int i; - int j = 0; TupleDesc desc; desc = RelationGetDescr(rel->localrel); - for (i = 0; i < desc->natts; i++) + for (int i = 0; i < desc->natts; i++) { int attnum; Form_pg_attribute attr = TupleDescAttr(desc, i); @@ -723,7 +721,7 @@ make_copy_attnamelist(LogicalRepRelMapEntry *rel, bool *attgenlist) * column name as a non-generated column in the corresponding * publication table. */ - if (attnum >=0 && !attgenlist[attnum]) + if (attnum >= 0 && !attgenlist[attnum]) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("logical replication target relation \"%s.%s\" is missing replicated column: \"%s\"", @@ -733,9 +731,8 @@ make_copy_attnamelist(LogicalRepRelMapEntry *rel, bool *attgenlist) gencollist = lappend_int(gencollist, attnum); } - for (i = 0; i < rel->remoterel.natts; i++) + for (int i = 0, j = 0; i < rel->remoterel.natts; i++) { - if (gencollist != NIL && j < gencollist->length && list_nth_int(gencollist, j) == i) j++; @@ -1190,8 +1187,8 @@ copy_table(Relation rel) initStringInfo(&cmd); /* - * Regular table with no row filter and 'include_generated_columns' us not - * specified as 'true' during creation of subscription. + * Regular table with no row filter and 'include_generated_columns' + * specified as 'false' during creation of subscription. */ if (lrel.relkind == RELKIND_RELATION && qual == NIL && !MySubscription->includegencol)