Re: ExecEvalVar does not have appropriate ExprState? - Mailing list pgsql-hackers
From | Vaibhav Kaushal |
---|---|
Subject | Re: ExecEvalVar does not have appropriate ExprState? |
Date | |
Msg-id | AANLkTinzkvThgG3ZdMwOrzE5eU47gvHtqwnBDdK5S1Uy@mail.gmail.com Whole thread Raw |
In response to | Re: ExecEvalVar does not have appropriate ExprState? (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>) |
Responses |
Re: ExecEvalVar does not have appropriate ExprState?
|
List | pgsql-hackers |
Thanks for the confirmation. I am happy to have understood some basics of PG. <br /><br />Also, I think the similar standsfor the Const, Param,<br /> CoerceToDomain and CaseTest nodes, right? They too cast the pointer to another type. <br/><br />Thanks for the help Heikki. (I could better call you HL, if you dont mind :P )<br /><br />Regards,<br />Vaibhav<br/><br /><br /><div class="gmail_quote">On Mon, Mar 28, 2011 at 1:05 PM, Heikki Linnakangas <span dir="ltr"><<ahref="mailto:heikki.linnakangas@enterprisedb.com">heikki.linnakangas@enterprisedb.com</a>></span> wrote:<br/><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On28.03.2011 10:02, Vaibhav Kaushal wrote:<br /><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px#ccc solid;padding-left:1ex"> Hi,<br /><br /> I see the ExecInitExpr says something like this:<br />------------<br /> case T_Var:<br /> state = (ExprState *) makeNode(ExprState);<br /> state->evalfunc= ExecEvalVar;<br /> ---------------<br /><br /><br /> But the ExecEvalVar function definition says:<br/><br /> ------------------------<br /> Var *variable = (Var *) exprstate->expr;<br /> TupleTableSlot*slot;<br /> AttrNumber attnum;<br /><br /> if (isDone)<br /> *isDone =ExprSingleResult;<br /><br /> /* Get the input slot and attribute number we want */<br /> switch (variable->varno)<br/> {<br /> case INNER: /* get the tuple from theinner node */<br /> -------------------------<br /><br /><br /> Since ExprState -> expr in its final form would finallycontain only:<br /><br /> NodeTag type;<br /><br /> I think that the pointer being cast in the ExecEvalVaris actually<br /> already a form of Var which is passed around as Expr for sake of<br /> function call.<br /></blockquote><br/></div> Right, exprstate->expr is a Var in ExecEvalVar.<div class="im"><br /><br /><blockquote class="gmail_quote"style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> So, was the node in the Expr treefor the corresponding ExprState node<br /> of the ExprState tree actually a 'Var'?<br /></blockquote><br /></div> Yes.<divclass="im"><br /><br /><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Also, I have tried, but failed to fidn the exact place where the Expr<br /> tree is created. Justpointing me to the file / function which does this<br /> would be of great help.<br /></blockquote><br /></div> A rawexpression tree is created in the grammar, src/backend/parser/gram.y. It is then transformed in parse analysis phase tothe form the planner accepts, in transformExpr(). The planner can do some further transformations, like replacing immutablefunction calls with Consts.<br /><font color="#888888"><br /> -- <br /> Heikki Linnakangas<br /> EnterpriseDB <a href="http://www.enterprisedb.com" target="_blank">http://www.enterprisedb.com</a><br /></font></blockquote></div><br/>
pgsql-hackers by date: