pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: rir <rirans@comcast.net>
Cc: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: pgsql-docs@lists.postgresql.org
Subject: Re: small patch
Date: Thu, 7 Oct 2021 17:18:49 -0300
Message-ID: <202110072018.yugknob35ubc@alvherre.pgsql> (raw)
In-Reply-To: <20211007200612.rkxxgeorw6w4fpjp@localhost>

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/





view thread (16+ messages)  latest in thread

Message-ID: <202110072018.yugknob35ubc@alvherre.pgsql>
Permalink:  ../202110072018.yugknob35ubc@alvherre.pgsql/
Also on:    postgresql.org/message-id/202110072018.yugknob35ubc@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: alvherre@alvh.no-ip.org, rirans@comcast.net, laurenz.albe@cybertec.at, pgsql-docs@lists.postgresql.org
  Subject: Re: small patch
  In-Reply-To: <202110072018.yugknob35ubc@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox