Re: Prepared statements and cursors

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Andreas Lubensky <lubensky(at)cognitec(dot)com>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Prepared statements and cursors
Date: 2014-01-28 14:16:25
Message-ID: CAHyXU0wxJcf8p2=ipNmXcaN1LxupEma0Dt0D=xuWZyGDyRd8Sg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jan 28, 2014 at 7:53 AM, Andreas Lubensky <lubensky(at)cognitec(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2014-01-28 17:32:00 Re: PostgreSQL 9.2.4 using large amount of memory
Previous Message Andreas Lubensky 2014-01-28 13:53:36 Re: Prepared statements and cursors