Skip to content

Commit 4a5f38c

Browse files
committed
Code review for holdable-cursors patch. Fix error recovery, memory
context sloppiness, some other things. Includes Neil's mopup patch of 22-Apr.
1 parent 6a17d22 commit 4a5f38c

File tree

18 files changed

+375
-312
lines changed

18 files changed

+375
-312
lines changed

doc/src/sgml/ref/declare.sgml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/declare.sgml,v 1.22 2003/04/06 22:41:52 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/declare.sgml,v 1.23 2003/04/29 03:21:28 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -70,8 +70,8 @@ DECLARE <replaceable class="parameter">cursorname</replaceable> [ BINARY ] [ INS
7070
<term>NO SCROLL</term>
7171
<listitem>
7272
<para>
73-
Specifies that the cursor cannot be used to retrieve rows in a
74-
nonsequential fashion (e.g., backward).
73+
Specifies that the cursor cannot be used to retrieve rows in a
74+
nonsequential fashion (e.g., backward).
7575
</para>
7676
</listitem>
7777
</varlistentry>
@@ -83,7 +83,7 @@ DECLARE <replaceable class="parameter">cursorname</replaceable> [ BINARY ] [ INS
8383
Specifies that the cursor may be used to retrieve rows in a
8484
nonsequential fashion (e.g., backward). Depending upon the
8585
complexity of the query's execution plan, specifying
86-
<literal>SCROLL</literal> may impose a slight performance penalty
86+
<literal>SCROLL</literal> may impose a performance penalty
8787
on the query's execution time.
8888
</para>
8989
</listitem>
@@ -96,7 +96,7 @@ DECLARE <replaceable class="parameter">cursorname</replaceable> [ BINARY ] [ INS
9696
Specifies that the cursor cannot be used outside of the
9797
transaction that created it. If neither <literal>WITHOUT
9898
HOLD</literal> nor <literal>WITH HOLD</literal> is specified,
99-
<literal>WITH HOLD</literal> is the default.
99+
<literal>WITHOUT HOLD</literal> is the default.
100100
</para>
101101
</listitem>
102102
</varlistentry>
@@ -105,8 +105,8 @@ DECLARE <replaceable class="parameter">cursorname</replaceable> [ BINARY ] [ INS
105105
<term>WITH HOLD</term>
106106
<listitem>
107107
<para>
108-
Specifies that the cursor may be used after the transaction
109-
that creates it successfully commits.
108+
Specifies that the cursor may continue to be used after the
109+
transaction that creates it successfully commits.
110110
</para>
111111
</listitem>
112112
</varlistentry>
@@ -163,7 +163,7 @@ DECLARE <replaceable class="parameter">cursorname</replaceable> [ BINARY ] [ INS
163163

164164
<para>
165165
The <literal>BINARY</literal>, <literal>INSENSITIVE</literal>,
166-
<literal>SCROLL</literal> keywords may appear in any order.
166+
and <literal>SCROLL</literal> keywords may appear in any order.
167167
</para>
168168
</refsect2>
169169

@@ -296,11 +296,14 @@ ERROR: DECLARE CURSOR may only be used in begin/end transaction blocks
296296
<para>
297297
If <literal>WITH HOLD</literal> is specified and the transaction
298298
that created the cursor successfully commits, the cursor can be
299-
accessed outside the creating transaction. If the creating
300-
transaction is aborted, the cursor is removed. A cursor created
299+
continue to be accessed by subsequent transactions in the same session.
300+
(But if the creating
301+
transaction is aborted, the cursor is removed.) A cursor created
301302
with <literal>WITH HOLD</literal> is closed when an explicit
302-
<command>CLOSE</command> command is issued on it, or the client
303-
connection is terminated.
303+
<command>CLOSE</command> command is issued on it, or when the client
304+
connection is terminated. In the current implementation, the rows
305+
represented by a held cursor are copied into a temporary file or
306+
memory area so that they remain available for subsequent transactions.
304307
</para>
305308

306309
<para>
@@ -312,7 +315,8 @@ ERROR: DECLARE CURSOR may only be used in begin/end transaction blocks
312315
plan is simple enough that no extra overhead is needed to support
313316
it. However, application developers are advised not to rely on
314317
using backward fetches from a cursor that has not been created
315-
with <literal>SCROLL</literal>.
318+
with <literal>SCROLL</literal>. If <literal>NO SCROLL</> is specified,
319+
then backward fetches are disallowed in any case.
316320
</para>
317321

318322
<para>

src/backend/catalog/sql_features.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ E121 Basic cursor support 06 Positioned UPDATE statement NO
9595
E121 Basic cursor support 07 Positioned DELETE statement NO
9696
E121 Basic cursor support 08 CLOSE statement YES
9797
E121 Basic cursor support 10 FETCH statement implicit NEXT YES
98-
E121 Basic cursor support 17 WITH HOLD cursors NO
98+
E121 Basic cursor support 17 WITH HOLD cursors YES
9999
E131 Null value support (nulls in lieu of values) YES
100100
E141 Basic integrity constraints YES
101101
E141 Basic integrity constraints 01 NOT NULL constraints YES
@@ -214,12 +214,12 @@ F401 Extended joined table 03 UNION JOIN YES
214214
F401 Extended joined table 04 CROSS JOIN YES
215215
F411 Time zone specification YES
216216
F421 National character YES
217-
F431 Read-only scrollable cursors NO
217+
F431 Read-only scrollable cursors YES
218218
F431 Read-only scrollable cursors 01 FETCH with explicit NEXT YES
219-
F431 Read-only scrollable cursors 02 FETCH FIRST NO
220-
F431 Read-only scrollable cursors 03 FETCH LAST NO
219+
F431 Read-only scrollable cursors 02 FETCH FIRST YES
220+
F431 Read-only scrollable cursors 03 FETCH LAST YES
221221
F431 Read-only scrollable cursors 04 FETCH PRIOR YES
222-
F431 Read-only scrollable cursors 05 FETCH ABSOLUTE NO
222+
F431 Read-only scrollable cursors 05 FETCH ABSOLUTE YES
223223
F431 Read-only scrollable cursors 06 FETCH RELATIVE YES
224224
F441 Extended set function support YES
225225
F451 Character set definition NO
@@ -319,7 +319,7 @@ T211 Basic trigger capability 04 FOR EACH ROW triggers YES
319319
T211 Basic trigger capability 05 Ability to specify a search condition that must be true before the trigger is invoked NO
320320
T211 Basic trigger capability 06 Support for run-time rules for the interaction of triggers and constraints NO
321321
T211 Basic trigger capability 07 TRIGGER privilege YES
322-
T211 Basic trigger capability 08 Multiple triggers for the same the event are executed in the order in which they were created NO
322+
T211 Basic trigger capability 08 Multiple triggers for the same event are executed in the order in which they were created NO intentionally omitted
323323
T212 Enhanced trigger capability YES
324324
T231 SENSITIVE cursors YES
325325
T241 START TRANSACTION statement YES

0 commit comments

Comments
 (0)