Citus Revise tree-walk APIs to include context (#6975)

Without revising there are Warnings in PG16 build

Relevant PG commit

1c27d16e6e
1c27d16e6e5c1f463bbe1e9ece88dda811235165
pull/6971/head
Naisila Puka 2023-06-06 14:17:51 +03:00 committed by GitHub
parent f6a516dab5
commit c2f117c559
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 12 deletions

View File

@ -43,7 +43,7 @@ static bool contain_dml_walker(Node *node, void *context);
/* the following utility functions are related to Citus' logic */ /* the following utility functions are related to Citus' logic */
static bool RecursivelyInlineCteWalker(Node *node, void *context); static bool RecursivelyInlineCteWalker(Node *node, void *context);
static void InlineCTEsInQueryTree(Query *query); static void InlineCTEsInQueryTree(Query *query);
static bool QueryTreeContainsInlinableCteWalker(Node *node); static bool QueryTreeContainsInlinableCteWalker(Node *node, void *context);
/* /*
@ -135,7 +135,7 @@ InlineCTEsInQueryTree(Query *query)
bool bool
QueryTreeContainsInlinableCTE(Query *queryTree) QueryTreeContainsInlinableCTE(Query *queryTree)
{ {
return QueryTreeContainsInlinableCteWalker((Node *) queryTree); return QueryTreeContainsInlinableCteWalker((Node *) queryTree, NULL);
} }
@ -144,7 +144,7 @@ QueryTreeContainsInlinableCTE(Query *queryTree)
* the (sub)queries in the node contains at least one CTE. * the (sub)queries in the node contains at least one CTE.
*/ */
static bool static bool
QueryTreeContainsInlinableCteWalker(Node *node) QueryTreeContainsInlinableCteWalker(Node *node, void *context)
{ {
if (node == NULL) if (node == NULL)
{ {

View File

@ -234,8 +234,8 @@ static List * FetchEqualityAttrNumsForRTEBoolExpr(BoolExpr *boolExpr);
static List * FetchEqualityAttrNumsForList(List *nodeList); static List * FetchEqualityAttrNumsForList(List *nodeList);
static int PartitionColumnIndex(Var *targetVar, List *targetList); static int PartitionColumnIndex(Var *targetVar, List *targetList);
static List * GetColumnOriginalIndexes(Oid relationId); static List * GetColumnOriginalIndexes(Oid relationId);
static bool QueryTreeHasImproperForDeparseNodes(Node *inputNode); static bool QueryTreeHasImproperForDeparseNodes(Node *inputNode, void *context);
static Node * AdjustImproperForDeparseNodes(Node *inputNode); static Node * AdjustImproperForDeparseNodes(Node *inputNode, void *context);
static bool IsImproperForDeparseRelabelTypeNode(Node *inputNode); static bool IsImproperForDeparseRelabelTypeNode(Node *inputNode);
static bool IsImproperForDeparseCoerceViaIONode(Node *inputNode); static bool IsImproperForDeparseCoerceViaIONode(Node *inputNode);
static CollateExpr * RelabelTypeToCollateExpr(RelabelType *relabelType); static CollateExpr * RelabelTypeToCollateExpr(RelabelType *relabelType);
@ -2698,9 +2698,9 @@ SqlTaskList(Job *job)
* the query sublinks, and we don't want to do that unless necessary, as it * the query sublinks, and we don't want to do that unless necessary, as it
* would be inefficient. * would be inefficient.
*/ */
if (QueryTreeHasImproperForDeparseNodes((Node *) jobQuery)) if (QueryTreeHasImproperForDeparseNodes((Node *) jobQuery, NULL))
{ {
jobQuery = (Query *) AdjustImproperForDeparseNodes((Node *) jobQuery); jobQuery = (Query *) AdjustImproperForDeparseNodes((Node *) jobQuery, NULL);
} }
ListCell *fragmentCombinationCell = NULL; ListCell *fragmentCombinationCell = NULL;
@ -5621,7 +5621,7 @@ TaskListHighestTaskId(List *taskList)
* CoerceViaIONodes which are improper for deparse * CoerceViaIONodes which are improper for deparse
*/ */
static bool static bool
QueryTreeHasImproperForDeparseNodes(Node *inputNode) QueryTreeHasImproperForDeparseNodes(Node *inputNode, void *context)
{ {
if (inputNode == NULL) if (inputNode == NULL)
{ {
@ -5653,7 +5653,7 @@ QueryTreeHasImproperForDeparseNodes(Node *inputNode)
* Details will be written in comments in the corresponding if conditions. * Details will be written in comments in the corresponding if conditions.
*/ */
static Node * static Node *
AdjustImproperForDeparseNodes(Node *inputNode) AdjustImproperForDeparseNodes(Node *inputNode, void *context)
{ {
if (inputNode == NULL) if (inputNode == NULL)
{ {

View File

@ -154,7 +154,7 @@ static DeferredErrorMessage * DeferErrorIfUnsupportedRouterPlannableSelectQuery(
static DeferredErrorMessage * ErrorIfQueryHasUnroutableModifyingCTE(Query *queryTree); static DeferredErrorMessage * ErrorIfQueryHasUnroutableModifyingCTE(Query *queryTree);
#if PG_VERSION_NUM >= PG_VERSION_14 #if PG_VERSION_NUM >= PG_VERSION_14
static DeferredErrorMessage * ErrorIfQueryHasCTEWithSearchClause(Query *queryTree); static DeferredErrorMessage * ErrorIfQueryHasCTEWithSearchClause(Query *queryTree);
static bool ContainsSearchClauseWalker(Node *node); static bool ContainsSearchClauseWalker(Node *node, void *context);
#endif #endif
static bool SelectsFromDistributedTable(List *rangeTableList, Query *query); static bool SelectsFromDistributedTable(List *rangeTableList, Query *query);
static ShardPlacement * CreateDummyPlacement(bool hasLocalRelation); static ShardPlacement * CreateDummyPlacement(bool hasLocalRelation);
@ -3929,7 +3929,7 @@ ErrorIfQueryHasUnroutableModifyingCTE(Query *queryTree)
static DeferredErrorMessage * static DeferredErrorMessage *
ErrorIfQueryHasCTEWithSearchClause(Query *queryTree) ErrorIfQueryHasCTEWithSearchClause(Query *queryTree)
{ {
if (ContainsSearchClauseWalker((Node *) queryTree)) if (ContainsSearchClauseWalker((Node *) queryTree, NULL))
{ {
return DeferredError(ERRCODE_FEATURE_NOT_SUPPORTED, return DeferredError(ERRCODE_FEATURE_NOT_SUPPORTED,
"CTEs with search clauses are not supported", "CTEs with search clauses are not supported",
@ -3944,7 +3944,7 @@ ErrorIfQueryHasCTEWithSearchClause(Query *queryTree)
* CommonTableExprs with search clause * CommonTableExprs with search clause
*/ */
static bool static bool
ContainsSearchClauseWalker(Node *node) ContainsSearchClauseWalker(Node *node, void *context)
{ {
if (node == NULL) if (node == NULL)
{ {