mirror of https://github.com/citusdata/citus.git
Refactors Object Type check code
parent
20caccb408
commit
f7dce78534
|
@ -154,6 +154,7 @@ static void RunPreprocessMainDBCommand(Node *parsetree, const char *queryString)
|
||||||
static void RunPostprocessMainDBCommand(Node *parsetree);
|
static void RunPostprocessMainDBCommand(Node *parsetree);
|
||||||
static bool IsStatementSupportedIn2PC(Node *parsetree);
|
static bool IsStatementSupportedIn2PC(Node *parsetree);
|
||||||
static bool DoesStatementRequireMarkDistributedFor2PC(Node *parsetree);
|
static bool DoesStatementRequireMarkDistributedFor2PC(Node *parsetree);
|
||||||
|
static bool IsObjectTypeSupported(Node *parsetree, TwoPcStatementInfo twoPcSupportedStatement);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ProcessUtilityParseTree is a convenience method to create a PlannedStmt out of
|
* ProcessUtilityParseTree is a convenience method to create a PlannedStmt out of
|
||||||
|
@ -1700,24 +1701,32 @@ IsStatementSupportedIn2PC(Node *parsetree)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (type == T_GrantStmt)
|
if (type == T_GrantStmt)
|
||||||
|
{
|
||||||
|
return IsObjectTypeSupported(parsetree, twoPcSupportedStatements[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsObjectTypeSupported(Node *parsetree, TwoPcStatementInfo twoPcSupportedStatement)
|
||||||
|
{
|
||||||
|
NodeTag type = nodeTag(parsetree);
|
||||||
|
if (type == T_GrantStmt)
|
||||||
{
|
{
|
||||||
GrantStmt *stmt = castNode(GrantStmt, parsetree);
|
GrantStmt *stmt = castNode(GrantStmt, parsetree);
|
||||||
/* check if stmt->objtype is in supportedObjectTypes */
|
/* check if stmt->objtype is in supportedObjectTypes */
|
||||||
for (int j = 0; j <
|
for (int j = 0; j < twoPcSupportedStatement.supportedObjectTypesSize; j++)
|
||||||
twoPcSupportedStatements[i].supportedObjectTypesSize; j++)
|
|
||||||
{
|
{
|
||||||
if (stmt->objtype ==
|
if (stmt->objtype == twoPcSupportedStatement.supportedObjectTypes[j])
|
||||||
twoPcSupportedStatements[i].supportedObjectTypes[j])
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue