On Wed, Feb 20, 2019 at 11:33 AM Dmitry Dolgov <9erthali...@gmail.com> wrote:
> > On Fri, Feb 1, 2019 at 8:24 PM Jesper Pedersen < > jesper.peder...@redhat.com> wrote: > > > > Dmitry and I will look at this and take it into account for the next > > version. > > In the meantime, just to not forget, I'm going to post another version > with a > fix for cursor fetch backwards, which was crashing before. This version of the patch can return the wrong answer. create index on pgbench_accounts (bid, aid); begin; declare c cursor for select distinct on (bid) bid, aid from pgbench_accounts order by bid, aid; fetch 2 from c; bid | aid -----+--------- 1 | 1 2 | 100,001 fetch backward 1 from c; bid | aid -----+--------- 1 | 100,000 Without the patch, instead of getting a wrong answer, I get an error: ERROR: cursor can only scan forward HINT: Declare it with SCROLL option to enable backward scan. If I add "SCROLL", then I do get the right answer with the patch. Cheers, Jeff