MOVE strangeness

From: "Jeroen T(dot) Vermeulen" <jtv(at)xs4all(dot)nl>
To: pgsql-hackers(at)postgresql(dot)org
Subject: MOVE strangeness
Date: 2002-12-26 01:44:30
Message-ID: 20021226014430.GP1393@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Here's something that's been bothering me for a while... Perhaps this
is correct behaviour, but I can't quite see how. This does not happen
if I replace the FETCHes by MOVEs.

Here's the reference case:

jtv=> begin;
BEGIN
jtv=> declare c cursor for select * from events;
DECLARE CURSOR
jtv=> fetch 3 in c;
year | event
------+------------------
2010 | A Space Oddyssey
2010 | Oddyssey Two
2038 | time_t overflow
(3 rows)

jtv=> move -3 in c;
MOVE 2
jtv=> fetch 3 in c;
year | event
------+------------------
2010 | A Space Oddyssey
2010 | Oddyssey Two
2038 | time_t overflow
(3 rows)

jtv=> end;
COMMIT

Okay, since that "move -3" claims to have moved only 2 rows backwards, I
tried the same but moving backwards by only 2 rows. This gives me the
same response for the MOVE, but my cursor evidently doesn't end up in
the same place:

jtv=> begin;
BEGIN
jtv=> declare c cursor for select * from events;
DECLARE CURSOR
jtv=> fetch 3 in c;
year | event
------+------------------
2010 | A Space Oddyssey
2010 | Oddyssey Two
2038 | time_t overflow
(3 rows)

jtv=> move -2 in c;
MOVE 2
jtv=> fetch 3 in c;
year | event
------+-----------------
2010 | Oddyssey Two
2038 | time_t overflow
1971 | jtv
(3 rows)

jtv=> end;
COMMIT

This makes it a bit hard for me to figure out just how far I moved my
cursor backwards! Moving by BACKWARD ALL will give me the same result
as moving by -3.

Is this behaviour intentional? If not, can it be fixed?

Jeroen

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message William.Jiang 2002-12-26 03:45:45 Re: why we need both the collector & buffer process
Previous Message Tom Lane 2002-12-25 21:56:53 Re: why we need both the collector & buffer process

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2002-12-26 18:26:11 Re: MOVE strangeness
Previous Message Giles Lean 2002-12-23 22:37:58 Fix for HP-UX shared library builds