Re: MOVE strangeness

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: MOVE strangeness
Дата
Msg-id 200212261904.gBQJ47U28993@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: MOVE strangeness  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: MOVE strangeness  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Why does the MOVE -3 return 2?
> 
> Because he's successfully backed up over 2 real rows.  Had he done FETCH
> -3 in the same situation, he'd have gotten back 2 rows; there is no
> third row it could have returned, so it's hard to argue that the count
> should be anything but 2.  (If you think it should be 3, what if I say
> MOVE -10000?  Should I get back a count of 10000?)

Sorry, I am not understanding.  If he does:jtv=> begin;BEGINjtv=> declare c cursor for select * from events;DECLARE
CURSORjtv=>fetch 3 in c; year |      event       ------+------------------ 2010 | A Space Oddyssey 2010 | Oddyssey Two
2038| time_t overflow(3 rows)
 

here, isn't he sitting at the start of the fourth row, no?  When he does
MOVE -3, doesn't he move from the start of the 4th row to the start of
the 1st row?jtv=> move -3 in c;MOVE 2

> > If he has fetched 3, he is at the end of
> > the third row.  If he does MOVE -3, hasn't he moved backward three rows
> > to the start of the first row?
> 
> There is no "end of a row" as distinct from "start of a row".  You can
> be on a row, or before the first row, or after the last row.  There is
> no other state besides that.

So, you are saying if he does a FETCH 3, he is still sitting on the 3rd
row, rather than at the gap between the 3rd and 4th rows?  If so, the
behavior does make sense.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: MOVE strangeness
Следующее
От: Tom Lane
Дата:
Сообщение: Re: MOVE strangeness