ExecEvalVar does not have appropriate ExprState? - Mailing list pgsql-hackers

From Vaibhav Kaushal
Subject ExecEvalVar does not have appropriate ExprState?
Date
Msg-id 1301295735.2410.12.camel@localhost
Whole thread Raw
Responses Re: ExecEvalVar does not have appropriate ExprState?
List pgsql-hackers
Hi,

I see the ExecInitExpr says something like this:
------------
case T_Var:state = (ExprState *) makeNode(ExprState);state->evalfunc = ExecEvalVar;
---------------


But the ExecEvalVar function definition says:

------------------------
Var           *variable = (Var *) exprstate->expr;TupleTableSlot *slot;AttrNumber    attnum;
if (isDone)    *isDone = ExprSingleResult;
/* Get the input slot and attribute number we want */switch (variable->varno){    case INNER:                /* get the
tuplefrom the inner node */
 
-------------------------


Since ExprState -> expr in its final form would finally contain only:

NodeTag        type;

I think that the pointer being cast in the ExecEvalVar is actually
already a form of Var which is passed around as Expr for sake of
function call. 

So, was the node in the Expr tree for the corresponding ExprState node
of the ExprState tree actually a 'Var'? I think without this being the
reality, the function ExecEvalVar would crash! In my belief, the similar
fact would stand for a few other nodes, notably Const, Param,
CoerceToDomain and CaseTest.

Also, I have tried, but failed to fidn the exact place where the Expr
tree is created. Just pointing me to the file / function which does this
would be of great help. 

Kindly correct me if I am wrong.

Regards,
Vaibhav 



pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Can I check if somebody is superuser in stored procedure?
Next
From: Heikki Linnakangas
Date:
Subject: Re: ExecEvalVar does not have appropriate ExprState?