From: Stoyan Genov <genov@digsys.bg>
To: Hiroshi Inoue <Inoue@tpf.co.jp>
To: pgsql-sql@postgresql.org
Subject: Re: [SQL] Move forward all (Was Re: How to get last 10 rows in a table on a large database?)
Date: Tue, 09 Nov 1999 13:15:34 +0200
Message-ID: <199911091115.NAA11001@lorna.digsys.bg> (raw)
In-Reply-To: <000f01bf2a6b$fc1eafc0$2801007e@cadzone.tpf.co.jp>
> > >
> > > > I knew the way to fix it but am not sure now.
> > > > Do you really want to make it possible ?
> > > > It isn't an appropriate way to get last rows because "move forward
> > > > all" takes very long time.
> > > >
> > >
> > > Of course it is not an appropriate way to get the last rows like this.
> > > The "right" way IMHO is to reverse the order in the query and to get the
> > > first
> > > rows.
> > >
> > > It is just for the sake of truth...
> > >
> >
> > OK Attached is a patch.
> > Could you apply to 6.5.3 ?
> >
>
> Sorry the patch is not right for 6.5.3 .
> Please apply the following patch to 6.5.3 .
>
> Regards.
>
> Hiroshi Inoue
> Inoue@tpf.co.jp
>
> *** access/heap/heapam.c.orig Mon Aug 2 14:56:36 1999
> --- access/heap/heapam.c Tue Nov 9 12:59:48 1999
> ***************
> *** 775,782 ****
> if (scan->rs_ptup.t_data == scan->rs_ctup.t_data &&
> BufferIsInvalid(scan->rs_pbuf))
> {
> - if (BufferIsValid(scan->rs_nbuf))
> - ReleaseBuffer(scan->rs_nbuf);
> return NULL;
> }
>
> --- 775,780 ----
> ***************
> *** 833,842 ****
> ReleaseBuffer(scan->rs_pbuf);
> scan->rs_ptup.t_data = NULL;
> scan->rs_pbuf = InvalidBuffer;
> - if (BufferIsValid(scan->rs_nbuf))
> - ReleaseBuffer(scan->rs_nbuf);
> - scan->rs_ntup.t_data = NULL;
> - scan->rs_nbuf = InvalidBuffer;
> return NULL;
> }
>
> --- 831,836 ----
> ***************
> *** 855,862 ****
> if (scan->rs_ctup.t_data == scan->rs_ntup.t_data &&
> BufferIsInvalid(scan->rs_nbuf))
> {
> - if (BufferIsValid(scan->rs_pbuf))
> - ReleaseBuffer(scan->rs_pbuf);
> HEAPDEBUG_3; /* heap_getnext returns NULL at end */
> return NULL;
> }
> --- 849,854 ----
> ***************
> *** 915,924 ****
> ReleaseBuffer(scan->rs_nbuf);
> scan->rs_ntup.t_data = NULL;
> scan->rs_nbuf = InvalidBuffer;
> - if (BufferIsValid(scan->rs_pbuf))
> - ReleaseBuffer(scan->rs_pbuf);
> - scan->rs_ptup.t_data = NULL;
> - scan->rs_pbuf = InvalidBuffer;
> HEAPDEBUG_6; /* heap_getnext returning EOS */
> return NULL;
> }
> --- 907,912 ----
>
>
>
> ************
>
I have applied the patch.
Now postgres 6.5.3 works fine (FETCH BACKWARD fetches
result after MOVE FORWARD ALL/FETCH FORWARD ALL).
Thank you very much.
Regards,
Stoyan Genov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: genov@digsys.bg, Inoue@tpf.co.jp
Subject: Re: [SQL] Move forward all (Was Re: How to get last 10 rows in a table on a large database?)
In-Reply-To: <199911091115.NAA11001@lorna.digsys.bg>
References: <000f01bf2a6b$fc1eafc0$2801007e@cadzone.tpf.co.jp> <199911091115.NAA11001@lorna.digsys.bg>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox