Handling RestrictInfo in expression_tree_walker - Mailing list pgsql-hackers

From Konstantin Knizhnik
Subject Handling RestrictInfo in expression_tree_walker
Date
Msg-id 20645147-d73b-989f-cee0-8a26b6251d10@postgrespro.ru
Whole thread Raw
Responses Re: Handling RestrictInfo in expression_tree_walker  (Amit Langote <amitlangote09@gmail.com>)
List pgsql-hackers
Hi hackers,

I wonder if there is some particular reason for not handling 
T_RestrictInfo node tag in expression_tree_walker?
There are many data structure in Postgres which contains lists of 
RestrictInfo or expression with RestrictInfo as parameter (for example 
orclause in RestrictInfo).
To handle such cases now it is needed to write code performing list 
iteration and calling expression_tree_walker for each list element and 
handling RrestrictInfo in callback function:

static bool
change_varno_walker(Node *node, ChangeVarnoContext *context)
{
     if (node == NULL)
         return false;

     if (IsA(node, Var) && ((Var *) node)->varno == context->oldRelid)
     {
         ((Var *) node)->varno = context->newRelid;
         ((Var *) node)->varnoold = context->newRelid;
         return false;
     }
     if (IsA(node, RestrictInfo))
     {
         change_rinfo((RestrictInfo*)node, context->oldRelid, 
context->newRelid);
         return false;
     }
     return expression_tree_walker(node, change_varno_walker, context);
}

Are there any complaints against handling RestrictInfo in 
expression_tree_walker?

-- 
Konstantin Knizhnik
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company




pgsql-hackers by date:

Previous
From: Surafel Temesgen
Date:
Subject: Re: FETCH FIRST clause PERCENT option
Next
From: Amit Langote
Date:
Subject: Re: partition routing layering in nodeModifyTable.c