cursor "x" does not exist

Поиск
Список
Период
Сортировка
От Bob Jones
Тема cursor "x" does not exist
Дата
Msg-id CA+HuS5F_anOtn+jJjF1VPuWX_pkOiN_FC2vPDDgkJhFs-s8CZQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: cursor "x" does not exist  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: cursor "x" does not exist  (rob stone <floriparob@gmail.com>)
Список pgsql-general
Hello,

My apologies if I'm being incredibly stupid here, but I've reviewed
what the docs have to say about naming portals and I still can't see
where I'm going wrong here ?

CREATE FUNCTION blah(v_id text,v_cursor refcursor) RETURNS refcursor
AS
$BODY$
BEGIN
OPEN v_cursor FOR SELECT *  FROM blah where idcol=v_id;
RETURN v_cursor;
END;
$BODY$
LANGUAGE plpgsql;

The select query in here does return data, so I know the output from
below is certainly expected to return something.

BEGIN;
SELECT blah('A','B');
blah
--------------------------
 B
(1 row)

FETCH ALL IN B;
ERROR:  cursor "b" does not exist



P.S. As a side-question, if anyone here has experience in using
Postgres as a backend to PHP, are refcursors the way to go or should I
be thinking of SETOF or other return styles ?


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

Предыдущее
От: David Steele
Дата:
Сообщение: Re: Barman versus pgBackRest
Следующее
От: Tom Lane
Дата:
Сообщение: Re: cursor "x" does not exist