Re: MOVE strangeness - Mailing list pgsql-hackers

From Tom Lane
Subject Re: MOVE strangeness
Date
Msg-id 2482.1040930080@sss.pgh.pa.us
Whole thread Raw
In response to Re: MOVE strangeness  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: MOVE strangeness
Re: MOVE strangeness
Re: MOVE strangeness
List pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Sorry, I am not understanding.  If he does:
> ...
> here, isn't he sitting at the start of the fourth row, no?

No.  He is sitting *on* the third row.  If he now does FETCH 1, he will
advance to and return the fourth row; on the other hand, if he does
FETCH -1, he will back up to and return the second row.

The cursor must be considered to be positioned on its current row, not
between rows, or the SQL-defined operations UPDATE WHERE CURRENT OF and
DELETE WHERE CURRENT OF don't make any sense.  (We don't support those
yet, but we should someday.)

BTW, looking at Date and the SQL spec, I now realize that the recently
made change to convert FETCH 0 into a no-op is wrong; per spec, FETCH
RELATIVE 0 means "re-fetch the current row, if any".  By analogy, MOVE 0
should probably return "MOVE 1" if you are on a real row, "MOVE 0" if
you are not, corresponding to the number of rows you'd have gotten from
FETCH 0.  Ugly, but ...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: MOVE strangeness
Next
From: Olivier PRENANT
Date:
Subject: Re: Problems with 7.3.1