Re: small patch

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: rir <rirans(at)comcast(dot)net>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: small patch
Date: 2021-10-07 20:18:49
Message-ID: 202110072018.yugknob35ubc@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On 2021-Oct-07, rir wrote:

> For myself,
> 'FETCH [ <direction> [ FROM | IN ] ] <cursor_name>'
> clearly indicates that 'direction' is optional.

Hmm, aren't you misreading the scope of the outer square brackets? If
<direction> is optional independently of [FROM|IN], then the synopsis
should be

FETCH [ <direction> ] [ FROM | IN ] <cursor_name>

and I think that's correct, since all forms omitting any of these are
accepted:

alvherre=# begin;
BEGIN
alvherre=*# declare c scroll cursor with hold for select 1 ;
DECLARE CURSOR
alvherre=*# commit;
COMMIT
alvherre=# fetch forward from c;
?column?
----------
1
(1 fila)

alvherre=# fetch from c;
?column?
----------
(0 filas)

alvherre=# fetch BACKWARD c;
?column?
----------
1
(1 fila)

alvherre=# fetch c;
?column?
----------
(0 filas)

--
Álvaro Herrera 39°49'30"S 73°17'W — https://www.EnterpriseDB.com/

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2021-10-07 20:24:16 Re: small patch
Previous Message rir 2021-10-07 20:06:12 Re: small patch