pg.ddx.io pgsql-sql@postgresql.org mailing list archivehelp / color / mirror / Atom feed
Unnamed Cursor return 2+ messages / 2 participants [nested] [flat]
* Unnamed Cursor return @ 2003-09-02 09:01 Kumar <sgnerd@yahoo.com.sg> 2003-09-02 14:05 ` Re: Unnamed Cursor return Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 1 reply; 2+ messages in thread From: Kumar @ 2003-09-02 09:01 UTC (permalink / raw) To: pgsql-sql Dear Friends, Using Postgres 7.3.4 on Linux 7.3 Server. Using PgAdmin II for Windows version 1.6.0 to connect to the server from my client machine. CREATE FUNCTION selfn() RETURNS refcursor AS 'DECLARE ref1 refcursor; BEGIN OPEN ref1 FOR SELECT * FROM address; RETURN ref1; END;' LANGUAGE 'plpgsql' VOLATILE; this works fine. I execute it at PgAdmin SELECT selfn(); an unnamed cursor is returned. fetch all from "<unnamed cursor 2 >"; at PgAdmin shows a popup window saying the query is executed, but the content is not shown. at command prompt SELECT selfn(); an unnamed cursor is returned. fetch all from "<unnamed cursor 2 >"; WARNING: PerformPortalFetch: portal "<unnamed cursor 1>" not found FETCH 0 (1) pls have a look in the function, that I have named the cursor as ref1, but again it is returning a unnamed cursor? (2) How to fetch the content of the unnamed cursor at PgAdmin and at Command prompt? Please help me with this, as it is much helpful for my development purpose. Regards Kumar ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Unnamed Cursor return 2003-09-02 09:01 Unnamed Cursor return Kumar <sgnerd@yahoo.com.sg> @ 2003-09-02 14:05 ` Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2003-09-02 14:05 UTC (permalink / raw) To: Kumar <sgnerd@yahoo.com.sg>; +Cc: pgsql-sql "Kumar" <sgnerd@yahoo.com.sg> writes: > (1) pls have a look in the function, that I have named the cursor as ref1, = > but again it is returning a unnamed cursor? This is not a bug. See the "returning cursors" section of the plpgsql manual. (IIRC, you can also create a named cursor by binding the cursor in DECLARE.) > (2) How to fetch the content of the unnamed cursor at PgAdmin and at Comman= > d prompt? You probably need a BEGIN block in the psql case. Can't help you with pgadmin. regards, tom lane ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2003-09-02 14:05 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2003-09-02 09:01 Unnamed Cursor return Kumar <sgnerd@yahoo.com.sg> 2003-09-02 14:05 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox