diff --git a/src/backend/distributed/commands/comment.c b/src/backend/distributed/commands/comment.c index d75bd8f3e..b3eb70d9d 100644 --- a/src/backend/distributed/commands/comment.c +++ b/src/backend/distributed/commands/comment.c @@ -34,12 +34,7 @@ GetCommentPropagationCommands(Oid oid, char *objectName, ObjectType objectType) char *commentObjectType = GetCommentObjectType(objectType); /* Create the SQL command to propagate the comment to other nodes */ - if (comment == NULL) - { - appendStringInfo(commentStmt, "COMMENT ON %s %s IS NULL;", commentObjectType, - quote_identifier(objectName)); - } - else + if (comment != NULL) { appendStringInfo(commentStmt, "COMMENT ON %s %s IS %s;", commentObjectType, quote_identifier(objectName), @@ -48,7 +43,10 @@ GetCommentPropagationCommands(Oid oid, char *objectName, ObjectType objectType) /* Add the command to the list */ - commands = list_make1(commentStmt->data); + if (commentStmt->len > 0) + { + commands = list_make1(commentStmt->data); + } return commands; } @@ -73,16 +71,15 @@ GetCommentObjectType(ObjectType objectType) static char * GetCommentForObject(Oid oid) { - Relation shdescRelation; - SysScanDesc scan; HeapTuple tuple; char *comment = NULL; /* Open pg_shdescription catalog */ - shdescRelation = table_open(SharedDescriptionRelationId, AccessShareLock); + Relation shdescRelation = table_open(SharedDescriptionRelationId, AccessShareLock); /* Scan the table */ - scan = systable_beginscan(shdescRelation, InvalidOid, false, NULL, 0, NULL); + SysScanDesc scan = systable_beginscan(shdescRelation, InvalidOid, false, NULL, 0, + NULL); while ((tuple = systable_getnext(scan)) != NULL) { Form_pg_shdescription shdesc = (Form_pg_shdescription) GETSTRUCT(tuple); diff --git a/src/backend/distributed/commands/database.c b/src/backend/distributed/commands/database.c index d8e94c4a4..2c070afdb 100644 --- a/src/backend/distributed/commands/database.c +++ b/src/backend/distributed/commands/database.c @@ -70,7 +70,6 @@ typedef struct DatabaseCollationInfo #endif } DatabaseCollationInfo; - static char * GenerateCreateDatabaseStatementFromPgDatabase(Form_pg_database databaseForm); static DatabaseCollationInfo GetDatabaseCollation(Oid dbOid);