Re: How to restore a Plan from a stored plan text?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: sunpeng <bluevaley(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to restore a Plan from a stored plan text?
Date: 2010-09-04 04:43:16
Message-ID: 7009.1283575396@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

sunpeng <bluevaley(at)gmail(dot)com> writes:
> I've used the following codes to translate the PlannedStmt node to a char
> string:
> PlannedStmt * pltl = (PlannedStmt *) linitial(plantree_list);
> Plan *pl = pltl->planTree;
> char *s;
> s = nodeToString(pl);

> How to restore from this s to Plan?

You can't. The fact that there's nodeToString support for all Plan node
types is only intended as a debugging aid --- there's no intention that
it should be possible to serialize and deserialize plans this way.

You didn't say what it is you actually hope to accomplish, but maybe
asking plancache.c to store the plan for you would do.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message sunpeng 2010-09-04 05:26:58 Re: How to restore a Plan from a stored plan text?
Previous Message sunpeng 2010-09-04 04:22:34 How to restore a Plan from a stored plan text?