Commit df389d16 authored by Bruce Momjian's avatar Bruce Momjian

Approaching the current documentation from a position of ignorance, I

find it ambiguous.  I propose something along the lines of the
following patch to clarify it.  Thanks.

(Alternatively, perhaps the code could maintain a count of nested
calls to SPI_connect/SPI_finish.  But I didn't try to write that
patch.)

Ian Lance Taylor
parent 941139bd
...@@ -34,10 +34,11 @@ using <Acronym>SPI</Acronym>. ...@@ -34,10 +34,11 @@ using <Acronym>SPI</Acronym>.
</Para> </Para>
<Para> <Para>
<Acronym>SPI</Acronym> procedures are always called by some (upper) Procedures which use <Acronym>SPI</Acronym> are called by the
Executor and the <Acronym>SPI</Acronym> Executor. The <Acronym>SPI</Acronym> calls recursively invoke the
manager uses the Executor to run your queries. Other procedures may be Executor in turn to run queries. When the Executor is invoked
called by the Executor running queries from your procedure. recursively, it may itself call procedures which may make
<Acronym>SPI</Acronym> calls.
</Para> </Para>
<Para> <Para>
...@@ -146,12 +147,17 @@ Return status ...@@ -146,12 +147,17 @@ Return status
utility SPI functions may be called from un-connected procedures. utility SPI functions may be called from un-connected procedures.
</PARA> </PARA>
<PARA> <PARA>
You may get <ReturnValue>SPI_ERROR_CONNECT</ReturnValue> error if <Function>SPI_connect</Function> is If your procedure is already connected,
called from an already connected procedure - e.g. if you directly call one <Function>SPI_connect</Function> will return an
procedure from another connected one. Actually, while the child procedure <ReturnValue>SPI_ERROR_CONNECT</ReturnValue> error. Note that this
will be able to use SPI, your parent procedure will not be able to continue may happen if a procedure which has called
to use SPI after the child returns (if <Function>SPI_finish</Function> is called by the child). <Function>SPI_connect</Function> directly calls another procedure
It's bad practice. which itself calls <Function>SPI_connect</Function>. While
recursive calls to the <Acronym>SPI</Acronym> manager are permitted
when an <Acronym>SPI</Acronym> query invokes another function which
uses <Acronym>SPI</Acronym>, directly nested calls to
<Function>SPI_connect</Function> and
<Function>SPI_finish</Function> are forbidden.
</PARA> </PARA>
</REFSECT1> </REFSECT1>
<REFSECT1 ID="R1-SPI-SPICONNECT-2"> <REFSECT1 ID="R1-SPI-SPICONNECT-2">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment