Re: move 0 behaviour

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Dave Cramer <dave(at)fastcrypt(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: move 0 behaviour
Date: 2002-10-30 05:04:15
Message-ID: 200210300504.g9U54Fi16676@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-jdbc

Dave Cramer wrote:
> Currently there is a TODO list item to have move 0 not position to the
> end of the cursor.
>
> Moving to the end of the cursor is useful, can we keep the behaviour and
> change it to move end, or just leave it the way it is?

I did some research on this. It turns out the parser uses 0 for ALL, so
when you do a FETCH ALL it is passing zero. Now, when you do MOVE 0,
you are really asking for FETCH ALL and all the tuples are thrown away
because of the MOVE.

So, that is why MOVE 0 goes to the end of the cursor. One idea would be
for MOVE 0 to actually move nothing, but jdbc and others need the
ability to move the end of the cursor, perhaps to then back up a certain
amount and read from there. Seems MOVE 0 is the logical way to do that.
(I can't think of another reasonable value).

I have the following patch which just documents the fact that MOVE 0
goes to the end of the cursor. It does not change any behavior, just
document it.

If/when I apply the patch, I will remove the TODO item. Another idea
would be to require MOVE END to move to the end.

Comments?

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

Attachment Content-Type Size
unknown_filename text/plain 2.8 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Savita 2002-10-30 05:19:01 Re: ONE MORE PERFORMANCE ISSUE WITH POSTGRES
Previous Message Ashish Lahori 2002-10-30 04:22:26 Re: Stream data into Postgres via Perl

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2002-10-30 06:35:09 Re: OO future
Previous Message Bruce Momjian 2002-10-30 02:56:58 Re: 7.3b3 passes on MacOSX 10.2.1

Browse pgsql-jdbc by date

  From Date Subject
Next Message Barry Lind 2002-10-30 05:24:38 Re: notification support
Previous Message sachi 2002-10-30 04:29:23 Problem in connecting to database