Re: refcursor

From: Ren Salomo <rene(at)ibiz(dot)com(dot)br>
To: Oliver Vecernik <vecernik(at)aon(dot)at>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: refcursor
Date: 2003-01-06 19:00:18
Message-ID: 20030106170018.4961f84e.rene@ibiz.com.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

U could try this:

CREATE OR REPLACE FUNCTION stat() RETURNS refcursor AS '
DECLARE
ref refcursor;

---------
change 4:
---------

CREATE OR REPLACE FUNCTION stat(refcursor) RETURNS refcursor AS '
DECLARE
cursor ALIAS FOR $1;
ref refcursor;

sport=# BEGIN;
sport=# select stat(cursor);
sport=# fetch all in cursor;
sport=# END;

It works fine with me!!!

On Sun, 05 Jan 2003 11:11:57 +0100
Oliver Vecernik <vecernik(at)aon(dot)at> wrote:

> Hi!
>
> I'm playing with refcursor, but I'm not successful. I defined follwing
> function:
>
> CREATE OR REPLACE FUNCTION stat() RETURNS refcursor AS '
> DECLARE
> ref refcursor;
> BEGIN
> OPEN ref FOR
> SELECT * FROM tagebuch;
> RETURN ref;
> END;
> ' LANGUAGE 'plpgsql';
>
> Trying to see some results gives me:
>
> sport=# select stat();
> ERROR: fmgr_info: function 16556: cache lookup failed
> sport=# select version();
> version
> ---------------------------------------------------------------
> PostgreSQL 7.2.1 on i686-pc-linux-gnu, compiled by GCC 2.95.4
> (1 row)
> sport=# select * from tagebuch;
> ...
>
> This works fine. I receive the same error when I try to call stat() from Python with pyPgSQL-DBI adaptor. What am I doing wrong (PostgreSQL runs on a Debian/Woody box)?
>
> Regards,
> Oliver
>
> --
> VECERNIK Datenerfassungssysteme
> A-2560 Hernstein, Hofkogelgasse 17
> Tel.: +43 2633 47530, Fax: DW 50
> http://members.aon.at/vecernik
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>

--
Renê Salomão
Ibiz Tecnologia -- www.ibiz.com.br

In response to

  • refcursor at 2003-01-05 10:11:57 from Oliver Vecernik

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Christoph Dalitz 2003-01-06 19:01:49 Re: Typcasting
Previous Message Stephan Szabo 2003-01-06 18:35:53 Re: parser error?