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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-bugs by date

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