Skip site navigation (1) Skip section navigation (2)

Re: move forward 0 from foo;

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Chester Kustarz <chester(at)arbor(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: move forward 0 from foo;
Date: 2004-03-23 22:37:10
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
Chester Kustarz <chester(at)arbor(dot)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

In response to

pgsql-sql by date

Next:From: Gregory S. WilliamsonDate: 2004-03-24 00:04:16
Subject: Re: function definition documentation
Previous:From: Chester KustarzDate: 2004-03-23 21:13:39
Subject: move forward 0 from foo;

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group