pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomasz Myrta <jasiek@klaster.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Lista dyskusyjna pgsql-sql <pgsql-sql@postgresql.org>
Subject: Re: cursors in plpgsql
Date: Thu, 18 Sep 2003 08:04:54 +0200
Message-ID: <3F694B06.3050802@klaster.net> (raw)
In-Reply-To: <5920.1063833193@sss.pgh.pa.us>
References: <3F68C810.6020401@klaster.net>
	<5920.1063833193@sss.pgh.pa.us>

> Releases before 7.4 are spotty about supporting backwards scan of
> complex queries --- if you have a join or aggregate in the query,
> it likely won't work, yielding either strange errors or wrong answers.
> 
> It will work if the top plan node in the query is a SORT, though, so
> a possible workaround is to add an explicit ORDER BY to the cursor's
> query.  (You will need to do some investigation with EXPLAIN to make
> sure you are getting a suitable plan for the cursor.)
I rewrote my query to have sort in top of plan:
Sort  (cost=151.24..151.25 rows=1 width=36)
    Sort Key: czas
    ->  Aggregate  (cost=151.22..151.23 rows=1 width=36)
          ->  Group  (cost=151.22..151.23 rows=1 width=36)
                ->  Sort  (cost=151.22..151.22 rows=1 width=36)
I'm not sure if it is what you were talking about, but it didn't help.

Anyway the best choice for this function would be a C function, but SPI 
scares me...

And one more question - which syntax is valid?
move backward..
or
execute ''move backward...


> Or try 7.4 beta ...
Currently stable branches are better for me...
> 
> 			regards, tom lane
Regards,
Tomasz Myrta




view thread (8+ messages)

Message-ID: <3F694B06.3050802@klaster.net>
Permalink:  ../3F694B06.3050802@klaster.net/
Also on:    postgresql.org/message-id/3F694B06.3050802@klaster.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jasiek@klaster.net, tgl@sss.pgh.pa.us
  Subject: Re: cursors in plpgsql
  In-Reply-To: <3F694B06.3050802@klaster.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox