Re: Synchronized scans

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Synchronized scans
Date: 2007-06-08 16:22:02
Message-ID: 27673.1181319722@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Heikki Linnakangas <heikki(at)enterprisedb(dot)com> writes:
> Tom Lane wrote:
>> Jeff Davis <pgsql(at)j-davis(dot)com> writes:
>>> Just to be sure: a backwards-started scan is currently unreachable code,
>>> correct?
>>
>> [ yawn... ] I think so, but I wouldn't swear to it right at the moment.
>> In any case it doesn't seem like a path that we need to optimize.

> Agreed, let's just disable the reporting when moving backwards.

Now that I'm awake, it is reachable code, per this comment:

* Note: when we fall off the end of the scan in either direction, we
* reset rs_inited. This means that a further request with the same
* scan direction will restart the scan, which is a bit odd, but a
* request with the opposite scan direction will start a fresh scan
* in the proper direction. The latter is required behavior for cursors,
* while the former case is generally undefined behavior in Postgres
* so we don't care too much.

That is, if you run a cursor to the end and then back up, you'll go
through the init-in-the-backwards-direction code.

But we're agreed that we don't want to report when moving backwards,
so this is just an interesting note...

regards, tom lane

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Jeff Davis 2007-06-08 17:24:22 Re: Synchronized scans
Previous Message Matthew T. O'Connor 2007-06-08 16:02:53 Re: COPYable logs status