Skip site navigation (1) Skip section navigation (2)

BUG #5549: Feature: plpgsql should allow DECLARE cursor FOR EXECUTE '...'

From: "David Schmitt" <david(at)dasz(dot)at>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #5549: Feature: plpgsql should allow DECLARE cursor FOR EXECUTE '...'
Date: 2010-07-09 12:11:56
Message-ID: 201007091211.o69CBumY096641@wwwmaster.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      5549
Logged by:          David Schmitt
Email address:      david(at)dasz(dot)at
PostgreSQL version: 8 and 9
Operating system:   n/a
Description:        Feature: plpgsql should allow DECLARE cursor FOR EXECUTE
'...'
Details: 

This is not implemented:

---------------------------------------------------------------------
CREATE OR REPLACE FUNCTION foo(tbl text) RETURNS void AS
$BODY$
DECLARE
    working_cursor NO SCROLL CURSOR FOR EXECUTE $$SELECT something $$ || tbl
|| $$ ... $$;
BEGIN
    FOR rec IN working_cursor LOOP
        -- ...
    END LOOP;
END$BODY$
LANGUAGE 'plpgsql' VOLATILE;
---------------------------------------------------------------------

The obvious workaround is hand-coding the LOOP with OPEN ... FOR EXECUTE and
manual FETCHing, but it would be great to have this missing piece supported
in syntax and avoid duplicating the error-prone hand-coding.



Thanks for your time and work!

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2010-07-09 13:26:44
Subject: Duplicate bugs (was Re: BUG #5547: not able to connect to postgres through the oracle using Linux ODBC driver for Postgres)
Previous:From: Dave PageDate: 2010-07-09 07:50:44
Subject: Re: BUG #5547: not able to connect to postgres through the oracle using Linux ODBC driver for Postgres

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group