Re: sql query cursor problem

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Risko Peter <risko(dot)peter(at)mhc(dot)hu>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: sql query cursor problem
Date: 2001-07-10 22:28:21
Message-ID: 15634.994804101@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Risko Peter <risko(dot)peter(at)mhc(dot)hu> writes:
> It seems we've found a bug in PostgreSQL handling of cursored queries.
> I assume that it's legal to do 'fetch backward all in xxx' and then
> 'fetch 1 in xxx' afterwards.

Backwards scan doesn't work right for any but the simplest sorts of
queries (no joins, no grouping or aggregation, probably some other
issues). It'd be nice to fix it, but it's not very high on anyone's
priority list. There are workarounds available, one of the simplest
being to specify ORDER BY --- the result of a sort step *can* be scanned
backwards, IIRC. Use EXPLAIN to make sure your query has a Sort at
the top level.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message pgsql-bugs 2001-07-11 00:34:33 ERROR: deferredTriggerGetPreviousEvent: event for tuple (0, 9) not found
Previous Message Paul A. Lender 2001-07-10 17:41:19 OpenSSH, Windows Clients, and Incoming Tunnels