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

From: "Hubert FONGARNAND" <h(dot)fongarnand(at)fiducial(dot)fr>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #2069: Cursors are not close outside of a function
Date: 2005-11-24 14:38:36
Message-ID: 20051124143836.CFCB0F0BC3@svr2.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 2069
Logged by: Hubert FONGARNAND
Email address: h(dot)fongarnand(at)fiducial(dot)fr
PostgreSQL version: 8.1
Operating system: Linux
Description: Cursors are not close outside of a function
Details:

I've written a little test function :

CREATE OR REPLACE FUNCTION test()
RETURNS void AS
$BODY$declare
c1 cursor for select * from essai;
c1_rec record;
begin
open c1;
fetch c1 into c1_rec;
end;$BODY$
LANGUAGE 'plpgsql' VOLATILE;

Note that i don't close c1 after returning...
(c1 should be close automatically because it is declared inside my
function);

If i execute :
select test();
select test();

the second select fails with :
ERROR: cursor "c1" already in use
CONTEXTE : PL/pgSQL function "test" line 5 at open

not that if I use to distinct connection it doesn't fails... It seems that a
cursor is a "global" variable inside a "postgres" process (1 connection).

It should be a bug!

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Darcy Buskermolen 2005-11-24 18:16:05 Re: [BUGS] BUG #2052: Federal Agency Tech Hub Refuses to Accept
Previous Message Peter Eisentraut 2005-11-24 14:09:09 Re: [BUGS] BUG #2052: Federal Agency Tech Hub Refuses to Accept