Skip site navigation (1) Skip section navigation (2)

Re: BUG #2069: Cursors are not close outside of a function

From: Jaime Casanova <systemguards(at)gmail(dot)com>
To: Hubert FONGARNAND <h(dot)fongarnand(at)fiducial(dot)fr>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2069: Cursors are not close outside of a function
Date: 2005-11-25 15:58:55
Message-ID: c2d9e70e0511250758p31551653g36a570234be8d613@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-bugs
On 11/24/05, Hubert FONGARNAND <h(dot)fongarnand(at)fiducial(dot)fr> wrote:
> Note that i don't close c1 after returning...
> (c1 should be close automatically because it is declared inside my
> function);
>

From the manual (signs are mine)...

35.8.3.3. Returning Cursors
PL/pgSQL functions can return cursors to the caller. This is useful to
return multiple rows or columns, especially with very large result
sets. To do this, the function opens the cursor and returns the cursor
name to the caller (or simply opens the cursor using a portal name
specified by or otherwise known to the caller). The caller can then
fetch rows from the cursor. The cursor can be closed
                                                                      
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
by the caller, or it will be closed automatically when the transaction closes.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

-----------------------------------

This is the behaviour i see in informix (i dunno for other major
databases)... Cursors closes at end of transaction or by the user...



--
Atentamente,
Jaime Casanova
(DBA: DataBase Aniquilator ;)

In response to

pgsql-bugs by date

Next:From: Keith RandallDate: 2005-11-25 16:13:55
Subject: BUG #2072: CPPFLAGS clobbered
Previous:From: Tom LaneDate: 2005-11-25 15:35:43
Subject: Re: BUG #2069: Cursors are not close outside of a function

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group