Fixes tests

pull/7388/head
gurkanindibay 2023-12-26 14:24:52 +03:00
parent 73685aa6d6
commit 0cd1dbecf0
2 changed files with 8 additions and 12 deletions

View File

@ -34,12 +34,7 @@ GetCommentPropagationCommands(Oid oid, char *objectName, ObjectType objectType)
char *commentObjectType = GetCommentObjectType(objectType); char *commentObjectType = GetCommentObjectType(objectType);
/* Create the SQL command to propagate the comment to other nodes */ /* Create the SQL command to propagate the comment to other nodes */
if (comment == NULL) if (comment != NULL)
{
appendStringInfo(commentStmt, "COMMENT ON %s %s IS NULL;", commentObjectType,
quote_identifier(objectName));
}
else
{ {
appendStringInfo(commentStmt, "COMMENT ON %s %s IS %s;", commentObjectType, appendStringInfo(commentStmt, "COMMENT ON %s %s IS %s;", commentObjectType,
quote_identifier(objectName), quote_identifier(objectName),
@ -48,7 +43,10 @@ GetCommentPropagationCommands(Oid oid, char *objectName, ObjectType objectType)
/* Add the command to the list */ /* Add the command to the list */
commands = list_make1(commentStmt->data); if (commentStmt->len > 0)
{
commands = list_make1(commentStmt->data);
}
return commands; return commands;
} }
@ -73,16 +71,15 @@ GetCommentObjectType(ObjectType objectType)
static char * static char *
GetCommentForObject(Oid oid) GetCommentForObject(Oid oid)
{ {
Relation shdescRelation;
SysScanDesc scan;
HeapTuple tuple; HeapTuple tuple;
char *comment = NULL; char *comment = NULL;
/* Open pg_shdescription catalog */ /* Open pg_shdescription catalog */
shdescRelation = table_open(SharedDescriptionRelationId, AccessShareLock); Relation shdescRelation = table_open(SharedDescriptionRelationId, AccessShareLock);
/* Scan the table */ /* 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) while ((tuple = systable_getnext(scan)) != NULL)
{ {
Form_pg_shdescription shdesc = (Form_pg_shdescription) GETSTRUCT(tuple); Form_pg_shdescription shdesc = (Form_pg_shdescription) GETSTRUCT(tuple);

View File

@ -70,7 +70,6 @@ typedef struct DatabaseCollationInfo
#endif #endif
} DatabaseCollationInfo; } DatabaseCollationInfo;
static char * GenerateCreateDatabaseStatementFromPgDatabase(Form_pg_database static char * GenerateCreateDatabaseStatementFromPgDatabase(Form_pg_database
databaseForm); databaseForm);
static DatabaseCollationInfo GetDatabaseCollation(Oid dbOid); static DatabaseCollationInfo GetDatabaseCollation(Oid dbOid);