Re: Hmm, nodeUnique doesn't really support backwards scan too well

Поиск
Список
Период
Сортировка
От Gregory Stark
Тема Re: Hmm, nodeUnique doesn't really support backwards scan too well
Дата
Msg-id 87proksj4q.fsf@oxford.xeocode.com
обсуждение исходный текст
Ответ на Re: Hmm, nodeUnique doesn't really support backwards scan too well  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Hmm, nodeUnique doesn't really support backwards scan too well  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
"Tom Lane" <tgl@sss.pgh.pa.us> writes:

> Gregory Stark <stark@enterprisedb.com> writes:
>> "Tom Lane" <tgl@sss.pgh.pa.us> writes:
>>> ...  I'm not even sure how to fix it (the nasty case is
>>> changing directions partway through the scan); let alone how to fix it in a
>>> way that's obviously enough right to make me feel comfortable in
>>> back-patching.
>
>> It seems like the obvious fix is to just reverse the behaviour -- keep
>> reading backwards until you see the level break then return the
>> previous record from a second slot.
>
> 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.

--
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com
  Ask me about EnterpriseDB's RemoteDBA services!

В списке pgsql-bugs по дате отправления:

Предыдущее
От: John R Pierce
Дата:
Сообщение: Re: Postgres Vacuum Password
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Hmm, nodeUnique doesn't really support backwards scan too well