SPI_connect opens a connection to the Postgres backend. You should call this function if you will need to execute queries. Some utility SPI functions may be called from un-connected procedures.
SPI_connect はPostgres バックエンドとの接続を開きます。問い合わせを実行する必要がある場合は、 この関数を呼び出す必要があります。SPI ユーティリティ関数には接続を行な わないプロシージャから呼び出すことができるものもあります。
You may get SPI_ERROR_CONNECT error if SPI_connect is called from an already connected procedure - e.g. if you directly call one procedure from another connected one. Actually, while the child procedure will be able to use SPI, your parent procedure will not be able to continue to use SPI after the child returns (if SPI_finish is called by the child). It's bad practice.
既に接続済みのプロシージャから SPI_connect が呼 び出された場合は、SPI_ERROR_CONNECT という エラーが返ります。例えば、接続済みのプロシージャから直接他のプロシー ジャを呼び出すような場合です。実際には、子プロシージャがSPIを使用可能 になっている場合、(その子プロシージャから SPI_finish が呼び出されると)親プロシージャは子プ ロシージャから戻った後に SPI を使用できなくなります。これを行なうことは 良くありません。