Thread: PlannerInfo Structure

PlannerInfo Structure

From
Ana Carolina Brito de Almeida
Date:
Hi all,<br /><br />I created a function which needs build or find a relation (RelOptInfo).<br />The build is ok.<br
/>Onthe other hand, I can't find the relation. I have all informations that pg_plan_query has: querytree (Query),
cursorOptions(int), boundParams(ParamListInfo) and plan (PlannedStmt).<br /> So, how can I take RelOptInfo by these
parameters?<br />I thought in use "find_base_rel", but it needs the PlannerInfo structure that I don't have.<br />Do
yourecommend another function? How can I find PlannerInfo with parameters that I have (Eg.: PlannedStmt)?<br /><br
/>Thanks,<br/>Ana Carolina<br /><br /><br /> 

Re: PlannerInfo Structure

From
Tom Lane
Date:
Ana Carolina Brito de Almeida <anacrl@ig.com.br> writes:
> I created a function which needs build or find a relation (RelOptInfo).
> The build is ok.
> On the other hand, I can't find the relation. I have all informations that
> pg_plan_query has: querytree (Query), cursorOptions (int),
> boundParams(ParamListInfo) and plan (PlannedStmt).
> So, how can I take RelOptInfo by these parameters?
> I thought in use "find_base_rel", but it needs the PlannerInfo structure
> that I don't have.
> Do you recommend another function? How can I find PlannerInfo with
> parameters that I have (Eg.: PlannedStmt)?

You can't; it's a transient structure and it's already gone after the
planner returns.  If you are plugging into the planning process
somewhere, it should be getting passed to you, but the data isn't
kept around after the plan is completed.
        regards, tom lane