Fixes review comments

pull/7388/head
gurkanindibay 2023-12-26 21:44:08 +03:00
parent 0cedf6f5f7
commit 089850f6ed
2 changed files with 9 additions and 4 deletions

View File

@ -996,6 +996,11 @@ static DistributeObjectOps TextSearchConfig_AlterOwner = {
}; };
static DistributeObjectOps TextSearchConfig_Comment = { static DistributeObjectOps TextSearchConfig_Comment = {
.deparse = DeparseCommentStmt, .deparse = DeparseCommentStmt,
/* TODO: When adding new comment types we should create an abstracted
* qualify function, just like we have an abstract deparse
* and adress function
*/
.qualify = QualifyTextSearchConfigurationCommentStmt, .qualify = QualifyTextSearchConfigurationCommentStmt,
.preprocess = PreprocessAlterDistributedObjectStmt, .preprocess = PreprocessAlterDistributedObjectStmt,
.postprocess = NULL, .postprocess = NULL,

View File

@ -34,7 +34,7 @@ typedef struct
int type; int type;
} ObjectTypeInfo; } ObjectTypeInfo;
const ObjectTypeInfo ObjectTypeNames[] = const ObjectTypeInfo ObjectTypeInfos[] =
{ {
[OBJECT_DATABASE] = { "DATABASE", T_String }, [OBJECT_DATABASE] = { "DATABASE", T_String },
[OBJECT_ROLE] = { "ROLE", T_String }, [OBJECT_ROLE] = { "ROLE", T_String },
@ -52,11 +52,11 @@ DeparseCommentStmt(Node *node)
initStringInfo(&str); initStringInfo(&str);
const char *objectName = NULL; const char *objectName = NULL;
if (ObjectTypeNames[stmt->objtype].type == T_String) if (IsA(stmt->object, String))
{ {
objectName = quote_identifier(strVal(stmt->object)); objectName = quote_identifier(strVal(stmt->object));
} }
else if (ObjectTypeNames[stmt->objtype].type == T_List) else if (IsA(stmt->object, List))
{ {
objectName = NameListToQuotedString(castNode(List, stmt->object)); objectName = NameListToQuotedString(castNode(List, stmt->object));
} }
@ -67,7 +67,7 @@ DeparseCommentStmt(Node *node)
errmsg("unknown object type"))); errmsg("unknown object type")));
} }
const char *objectType = ObjectTypeNames[stmt->objtype].name; const char *objectType = ObjectTypeInfos[stmt->objtype].name;
char *comment = stmt->comment != NULL ? quote_literal_cstr(stmt->comment) : "NULL"; char *comment = stmt->comment != NULL ? quote_literal_cstr(stmt->comment) : "NULL";