- publishing free software manuals
PostgreSQL Reference Manual - Volume 2 - Programming Guide
by The PostgreSQL Global Development Group
Paperback (6"x9"), 408 pages
ISBN 0954612035
RRP £19.95 ($34.95)

Sales of this book support the PostgreSQL project! Get a printed copy>>>

13.1.18 SPI_saveplan


SPI_saveplan -- save a plan


void * SPI_saveplan(void * plan)


SPI_saveplan saves a passed plan (prepared by SPI_prepare) in memory protected from freeing by SPI_finish 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.


void * plan
the plan to be saved

Return Value

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 SPI_execute_plan for this plan will be unpredictable.

ISBN 0954612035PostgreSQL Reference Manual - Volume 2 - Programming GuideSee the print edition