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

Поиск
Список
Период
Сортировка
От Hubert FONGARNAND
Тема BUG #2069: Cursors are not close outside of a function
Дата
Msg-id 20051124143836.CFCB0F0BC3@svr2.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #2069: Cursors are not close outside of a function  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: BUG #2069: Cursors are not close outside of a function  (Jaime Casanova <systemguards@gmail.com>)
Список pgsql-bugs
The following bug has been logged online:

Bug reference:      2069
Logged by:          Hubert FONGARNAND
Email address:      h.fongarnand@fiducial.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!

В списке pgsql-bugs по дате отправления:

Предыдущее
От: mattias
Дата:
Сообщение: Re: BUG #2042: Installation failed
Следующее
От: "Jan Jockusch"
Дата:
Сообщение: BUG #2070: Encoding dependent error in comparison operators