Re: Hmm, nodeUnique doesn't really support backwards scan too well - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Hmm, nodeUnique doesn't really support backwards scan too well
Date
Msg-id 26381.1218138637@sss.pgh.pa.us
Whole thread Raw
In response to Re: Hmm, nodeUnique doesn't really support backwards scan too well  (Gregory Stark <stark@enterprisedb.com>)
Responses Re: Hmm, nodeUnique doesn't really support backwards scan too well
List pgsql-bugs
Gregory Stark <stark@enterprisedb.com> writes:
> "Tom Lane" <tgl@sss.pgh.pa.us> writes:
>> Well, if you think it's easy, the best form of criticism is a patch.
>> The change-of-direction problem seems to me to be messy --- not
>> insoluble, but messy enough to need beta testing.

> Hm, I must have misunderstood the bug because there's a comment in nodeUnique
> which claims it already does precisely what I was suggesting:

>      * We return the first tuple from each group of duplicates (or the last
>      * tuple of each group, when moving backwards).  At either end of the
>      * subplan, clear the result slot so that we correctly return the
>      * first/last tuple when reversing direction.

That's what it *used* to say.  But the problem is that that's the wrong
behavior, because you get different tuples returned depending on which way
you are traveling.  It's only workable if the tuples in a group are
completely indistinguishable.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Gregory Stark
Date:
Subject: Re: Hmm, nodeUnique doesn't really support backwards scan too well
Next
From: Gregory Stark
Date:
Subject: Re: Hmm, nodeUnique doesn't really support backwards scan too well