SPI_saveplan <refpurpose>save a prepared statement</refpurpose> — 準備済み文を保存する
SPIPlanPtr SPI_saveplan(SPIPlanPtr plan)
   <function>SPI_saveplan</function> copies a passed statement (prepared by
   <function>SPI_prepare</function>) into memory that will not be freed
   by <function>SPI_finish</function> nor by the transaction manager,
   and returns a pointer to the copied statement.  This gives you the
   ability to reuse prepared statements in the subsequent invocations of
   your C function in the current session.
SPI_saveplanは渡された(SPI_prepareで準備された)文をSPI_finishとトランザクションマネージャで解放されないメモリ内にコピーします。
そして、コピーした文のポインタを返します。
これは、現在のセッションにおける、その後のC関数の呼び出しで準備済み文を再利用できる機能を提供します。
  
SPIPlanPtr planthe prepared statement to be saved 保存する準備済み文
   Pointer to the copied statement; or <symbol>NULL</symbol> if unsuccessful.
   On error, <varname>SPI_result</varname> is set thus:
コピーした文へのポインタ。
失敗した場合はNULLです。
エラー時、SPI_resultは以下のように設定されます。
   
SPI_ERROR_ARGUMENT
       if <parameter>plan</parameter> is <symbol>NULL</symbol> or invalid
planがNULL、または無効な場合
      
SPI_ERROR_UNCONNECTEDif called from an unconnected C function 未接続のC関数から呼び出された場合
   The originally passed-in statement is not freed, so you might wish to do
   <function>SPI_freeplan</function> on it to avoid leaking memory
   until <function>SPI_finish</function>.
渡された元の文は解放されません。
ですので、SPI_finishを行うまでのメモリリークを防ぎたければSPI_freeplanを実行してください。
  
   In most cases, <function>SPI_keepplan</function> is preferred to this
   function, since it accomplishes largely the same result without needing
   to physically copy the prepared statement's data structures.
準備済み文のデータ構造を物理的にコピーする必要なく、ほとんど同じ結果をもたらしますので、たいていの場合、この関数よりもSPI_keepplanの方が好ましいです。