diff options
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/plpgsql.sgml | 9 | ||||
-rw-r--r-- | doc/src/sgml/ref/declare.sgml | 8 |
2 files changed, 14 insertions, 3 deletions
diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml index b562bfd9c30..5c546f630fe 100644 --- a/doc/src/sgml/plpgsql.sgml +++ b/doc/src/sgml/plpgsql.sgml @@ -3033,6 +3033,15 @@ DECLARE is said to be <firstterm>unbound</firstterm> since it is not bound to any particular query. </para> + + <para> + The <literal>SCROLL</literal> option cannot be used when the cursor's + query uses <literal>FOR UPDATE/SHARE</literal>. Also, it is + best to use <literal>NO SCROLL</literal> with a query that involves + volatile functions. The implementation of <literal>SCROLL</literal> + assumes that re-reading the query's output will give consistent + results, which a volatile function might not do. + </para> </sect2> <sect2 id="plpgsql-cursor-opening"> diff --git a/doc/src/sgml/ref/declare.sgml b/doc/src/sgml/ref/declare.sgml index d6177dcd9c4..951dfa982ba 100644 --- a/doc/src/sgml/ref/declare.sgml +++ b/doc/src/sgml/ref/declare.sgml @@ -228,12 +228,14 @@ DECLARE <replaceable class="parameter">name</replaceable> [ BINARY ] [ INSENSITI <caution> <para> - Scrollable and <literal>WITH HOLD</literal> cursors may give unexpected + Scrollable cursors may give unexpected results if they invoke any volatile functions (see <xref linkend="xfunc-volatility"/>). When a previously fetched row is re-fetched, the functions might be re-executed, perhaps leading to - results different from the first time. One workaround for such cases - is to declare the cursor <literal>WITH HOLD</literal> and commit the + results different from the first time. It's best to + specify <literal>NO SCROLL</literal> for a query involving volatile + functions. If that is not practical, one workaround + is to declare the cursor <literal>SCROLL WITH HOLD</literal> and commit the transaction before reading any rows from it. This will force the entire output of the cursor to be materialized in temporary storage, so that volatile functions are executed exactly once for each row. |