mirror of https://github.com/citusdata/citus.git
Fixes review notes
parent
78d850950b
commit
94450cd391
|
@ -1672,48 +1672,6 @@ RunPostprocessMainDBCommand(Node *parsetree)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* GetObjectInfo returns ObjectInfo for the target object of given parsetree.
|
|
||||||
*/
|
|
||||||
static ObjectInfo
|
|
||||||
GetObjectInfo(Node *parsetree)
|
|
||||||
{
|
|
||||||
if (IsA(parsetree, CreateRoleStmt))
|
|
||||||
{
|
|
||||||
CreateRoleStmt *stmt = castNode(CreateRoleStmt, parsetree);
|
|
||||||
ObjectInfo info = {
|
|
||||||
.name = stmt->role,
|
|
||||||
.id = get_role_oid(stmt->role, false)
|
|
||||||
};
|
|
||||||
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add else if branches for other statement types */
|
|
||||||
|
|
||||||
elog(ERROR, "unsupported statement type");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* MarkObjectDistributedInNonMainDb marks the given object as distributed on the
|
|
||||||
* non-main database.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
MarkObjectDistributedInNonMainDb(Node *parsetree)
|
|
||||||
{
|
|
||||||
ObjectInfo objectInfo = GetObjectInfo(parsetree);
|
|
||||||
StringInfo mainDBQuery = makeStringInfo();
|
|
||||||
appendStringInfo(mainDBQuery,
|
|
||||||
MARK_OBJECT_DISTRIBUTED,
|
|
||||||
AuthIdRelationId,
|
|
||||||
quote_literal_cstr(objectInfo.name),
|
|
||||||
objectInfo.id,
|
|
||||||
quote_literal_cstr(CurrentUserName()));
|
|
||||||
RunCitusMainDBQuery(mainDBQuery->data);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IsStatementSupportedInNonMainDb returns true if the statement is supported from a
|
* IsStatementSupportedInNonMainDb returns true if the statement is supported from a
|
||||||
* non-main database.
|
* non-main database.
|
||||||
|
@ -1756,3 +1714,45 @@ StatementRequiresMarkDistributedFromNonMainDb(Node *parsetree)
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* MarkObjectDistributedInNonMainDb marks the given object as distributed on the
|
||||||
|
* non-main database.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
MarkObjectDistributedInNonMainDb(Node *parsetree)
|
||||||
|
{
|
||||||
|
ObjectInfo objectInfo = GetObjectInfo(parsetree);
|
||||||
|
StringInfo mainDBQuery = makeStringInfo();
|
||||||
|
appendStringInfo(mainDBQuery,
|
||||||
|
MARK_OBJECT_DISTRIBUTED,
|
||||||
|
AuthIdRelationId,
|
||||||
|
quote_literal_cstr(objectInfo.name),
|
||||||
|
objectInfo.id,
|
||||||
|
quote_literal_cstr(CurrentUserName()));
|
||||||
|
RunCitusMainDBQuery(mainDBQuery->data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* GetObjectInfo returns ObjectInfo for the target object of given parsetree.
|
||||||
|
*/
|
||||||
|
static ObjectInfo
|
||||||
|
GetObjectInfo(Node *parsetree)
|
||||||
|
{
|
||||||
|
if (IsA(parsetree, CreateRoleStmt))
|
||||||
|
{
|
||||||
|
CreateRoleStmt *stmt = castNode(CreateRoleStmt, parsetree);
|
||||||
|
ObjectInfo info = {
|
||||||
|
.name = stmt->role,
|
||||||
|
.id = get_role_oid(stmt->role, false)
|
||||||
|
};
|
||||||
|
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Add else if branches for other statement types */
|
||||||
|
|
||||||
|
elog(ERROR, "unsupported statement type");
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue