Re: Prepared statements and cursors - Mailing list pgsql-general

From Merlin Moncure
Subject Re: Prepared statements and cursors
Date
Msg-id CAHyXU0wxJcf8p2=ipNmXcaN1LxupEma0Dt0D=xuWZyGDyRd8Sg@mail.gmail.com
Whole thread Raw
In response to Re: Prepared statements and cursors  (Andreas Lubensky <lubensky@cognitec.com>)
List pgsql-general
On Tue, Jan 28, 2014 at 7:53 AM, Andreas Lubensky <lubensky@cognitec.com> wrote:
> That is an interesting approach. However, I see the problem that the
> functions would have to be removed when no longer needed. If that fails
> (broken connection etc.), they would be orphaned.
> Prepared statements are bound to the connection, so when the connection
> is closed they are gone.

well, you could abstract the function:
create or replace function eval(text) returns void as $$ begin execute
$1; end; $$ language plpgsql;
select eval('declare v cursor for select 0');

note, here eval() is a gaping security hole, so be advised.

merlin


pgsql-general by date:

Previous
From: Andreas Lubensky
Date:
Subject: Re: Prepared statements and cursors
Next
From: Bruce Momjian
Date:
Subject: Re: PostgreSQL 9.2.4 using large amount of memory