pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Chester Kustarz <chester@arbor.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: move forward 0 from foo;
Date: Tue, 23 Mar 2004 17:37:10 -0500
Message-ID: <7253.1080081430@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.BSO.4.44.0403231601530.18218-100000@detroit.arbor.net>
References: <Pine.BSO.4.44.0403231601530.18218-100000@detroit.arbor.net>

Chester Kustarz <chester@arbor.net> writes:
> I expected "MOVE FORWARD 0 FROM foo;" to always return
> 0, but I have found this not to be the case.

You are misinterpreting the output.  The result is the number of rows
that would have been returned by a FETCH with the same parameters.
FETCH 0 means "re-fetch current row" (don't blame us, this is per SQL
spec), and so it will return 1 row unless you are currently positioned
off the end of the result.  Hence, MOVE 0 returns either 0 or 1
depending on whether you are currently on a row.

It looks like the MOVE documentation is a bit poorly worded; I'll do
something about that.

			regards, tom lane



view thread (2+ messages)

Message-ID: <7253.1080081430@sss.pgh.pa.us>
Permalink:  ../7253.1080081430@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7253.1080081430@sss.pgh.pa.us

 · 

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-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, chester@arbor.net
  Subject: Re: move forward 0 from foo;
  In-Reply-To: <7253.1080081430@sss.pgh.pa.us>

* 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