Skip to content

Commit f38d5a2

Browse files
committed
Doc: minor improvement in pl/pgsql FETCH/MOVE documentation.
Explain that you can use any integer expression for the "count" in pl/pgsql's versions of FETCH/MOVE, unlike the SQL versions which only allow a constant. Remove the duplicate version of this para under MOVE. I don't see a good reason to maintain two identical paras when we just said that MOVE works exactly like FETCH. Per Pavel Stehule, though I didn't use his text. Discussion: https://postgr.es/m/CAFj8pRAcvSXcNdUGx43bOK1e3NNPbQny7neoTLN42af+8MYWEA@mail.gmail.com
1 parent 98e2c29 commit f38d5a2

File tree

2 files changed

+5
-21
lines changed

2 files changed

+5
-21
lines changed

doc/src/sgml/plpgsql.sgml

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3153,6 +3153,10 @@ FETCH <optional> <replaceable>direction</replaceable> { FROM | IN } </optional>
31533153
<literal>BACKWARD</>.
31543154
Omitting <replaceable>direction</replaceable> is the same
31553155
as specifying <literal>NEXT</>.
3156+
In the forms using a <replaceable>count</replaceable>,
3157+
the <replaceable>count</replaceable> can be any integer-valued
3158+
expression (unlike the SQL <command>FETCH</command> command,
3159+
which only allows an integer constant).
31563160
<replaceable>direction</replaceable> values that require moving
31573161
backward are likely to fail unless the cursor was declared or opened
31583162
with the <literal>SCROLL</> option.
@@ -3190,26 +3194,6 @@ MOVE <optional> <replaceable>direction</replaceable> { FROM | IN } </optional> <
31903194
be checked to see whether there was a next row to move to.
31913195
</para>
31923196

3193-
<para>
3194-
The <replaceable>direction</replaceable> clause can be any of the
3195-
variants allowed in the SQL <xref linkend="sql-fetch">
3196-
command, namely
3197-
<literal>NEXT</>,
3198-
<literal>PRIOR</>,
3199-
<literal>FIRST</>,
3200-
<literal>LAST</>,
3201-
<literal>ABSOLUTE</> <replaceable>count</replaceable>,
3202-
<literal>RELATIVE</> <replaceable>count</replaceable>,
3203-
<literal>ALL</>,
3204-
<literal>FORWARD</> <optional> <replaceable>count</replaceable> | <literal>ALL</> </optional>, or
3205-
<literal>BACKWARD</> <optional> <replaceable>count</replaceable> | <literal>ALL</> </optional>.
3206-
Omitting <replaceable>direction</replaceable> is the same
3207-
as specifying <literal>NEXT</>.
3208-
<replaceable>direction</replaceable> values that require moving
3209-
backward are likely to fail unless the cursor was declared or opened
3210-
with the <literal>SCROLL</> option.
3211-
</para>
3212-
32133197
<para>
32143198
Examples:
32153199
<programlisting>

doc/src/sgml/ref/fetch.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ FETCH [ <replaceable class="PARAMETER">direction</replaceable> [ FROM | IN ] ] <
9999
This page describes usage of cursors at the SQL command level.
100100
If you are trying to use cursors inside a <application>PL/pgSQL</>
101101
function, the rules are different &mdash;
102-
see <xref linkend="plpgsql-cursors">.
102+
see <xref linkend="plpgsql-cursor-using">.
103103
</para>
104104
</note>
105105
</refsect1>

0 commit comments

Comments
 (0)