Fixes review issues

pull/7388/head
gurkanindibay 2023-12-26 21:53:47 +03:00
parent 089850f6ed
commit 8387942d92
2 changed files with 7 additions and 29 deletions

View File

@ -21,14 +21,6 @@
#include "distributed/comment.h"
const CommentStmtType commentStmtTypes[] = {
{ OBJECT_DATABASE, "DATABASE" },
{ OBJECT_ROLE, "ROLE" }
};
static char * GetCommentObjectType(ObjectType objectType);
static char * GetCommentForObject(Oid oid);
@ -41,7 +33,7 @@ GetCommentPropagationCommands(Oid oid, char *objectName, ObjectType objectType)
/* Get the comment for the database */
char *comment = GetCommentForObject(oid);
char *commentObjectType = GetCommentObjectType(objectType);
char *commentObjectType = ObjectTypeInfos[objectType].name;
/* Create the SQL command to propagate the comment to other nodes */
if (comment != NULL)
@ -62,22 +54,6 @@ GetCommentPropagationCommands(Oid oid, char *objectName, ObjectType objectType)
}
static char *
GetCommentObjectType(ObjectType objectType)
{
char *objectName = NULL;
for (int i = 0; i < sizeof(commentStmtTypes) / sizeof(CommentStmtType); i++)
{
if (commentStmtTypes[i].objectType == objectType)
{
objectName = commentStmtTypes[i].objectName;
break;
}
}
return objectName;
}
static char *
GetCommentForObject(Oid oid)
{

View File

@ -15,11 +15,13 @@
#include "nodes/parsenodes.h"
typedef struct CommentStmtType
typedef struct
{
ObjectType objectType;
char *objectName;
} CommentStmtType;
char *name;
int type;
} ObjectTypeInfo;
extern const ObjectTypeInfo ObjectTypeInfos[];
extern List * GetCommentPropagationCommands(Oid oid, char *objectName, ObjectType