saves a passed plan (prepared by
) in memory protected from freeing by
and by the transaction manager and returns a pointer to the saved plan. This gives you the ability to reuse prepared plans in the subsequent invocations of your procedure in the current session.
Pointer to the saved plan; NULL if unsuccessful. On error, SPI_result is set thus:
if plan is NULL
if called from an unconnected procedure
If one of the objects (a table, function, etc.) referenced by the prepared plan is dropped during the session then the results of
for this plan will be unpredictable.