pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Don Croata <el.croata@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: Cursors and recursion
Date: Wed, 28 Dec 2005 16:37:21 -0300
Message-ID: <be9533860512281137u42cc2a16hcd2d5b703a809bdd@mail.gmail.com> (raw)
In-Reply-To: <17343.1135784905@sss.pgh.pa.us>
References: <be9533860512280629m1c1163bm73fef37f17541423@mail.gmail.com>
	<17343.1135784905@sss.pgh.pa.us>

Please, if someone recalls a link, book, piece of code or anything with info
about this technique for PL/PgSQL (8.1), please let us know. We've been
searching into google, groups.google, http://archives.postgresql.org and
http://www.postgresql.org/docs/8.1/interactive with no results. Most of the
answers are related to unclosed cursors for the "ERROR: cursor ... already
in use" message.

Here's the sample code for this issue (i.e. error because cursor already
defined in recursive PL/PgSQL function) at: http://www.croata.cl/cur.sql

--

Thanx again,
Cro

On 12/28/05, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Don Croata <el.croata@gmail.com> writes:
> > It's a function who has a cursor and calls itself, but the problem
> raises
> > after the first recursion, when PgSQL complains:
>
> > ERROR:  cursor "cur" already in use
>
> > Are the cursors kept globally? or cached like TEMP TABLE?
>
> Cursor names are global within a particular session.
>
> IIRC there is a syntax for opening a cursor without specifying a name,
> in which case plpgsql will pick one that's not in use.  This is probably
> what you want to use.
>
>                        regards, tom lane
>

view thread (5+ messages)  latest in thread

Message-ID: <be9533860512281137u42cc2a16hcd2d5b703a809bdd@mail.gmail.com>
Permalink:  ../be9533860512281137u42cc2a16hcd2d5b703a809bdd@mail.gmail.com/
Also on:    postgresql.org/message-id/be9533860512281137u42cc2a16hcd2d5b703a809bdd@mail.gmail.com

 · 

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: el.croata@gmail.com
  Subject: Re: Cursors and recursion
  In-Reply-To: <be9533860512281137u42cc2a16hcd2d5b703a809bdd@mail.gmail.com>

* 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