Re: WITH HOLD ref cursors for plpgsql - Mailing list pgsql-novice

From Tom Lane
Subject Re: WITH HOLD ref cursors for plpgsql
Date
Msg-id 24040.1361350004@sss.pgh.pa.us
Whole thread Raw
In response to Re: WITH HOLD ref cursors for plpgsql  (Daniel Wood <dwood@salesforce.com>)
List pgsql-novice
Daniel Wood <dwood@salesforce.com> writes:
> So how does one create a "WITH HOLD ref cursor for plpgsql"?

You don't --- as the previous thread mentioned, there doesn't seem
to be a lot of use-case for that, and it goes against plpgsql's
model of cursors as essentially being local variables of functions.

If you're really feeling desperate to use plpgsql to create a cursor
that will be used later by some calling application, you could probably
do EXECUTE 'DECLARE c CURSOR WITH HOLD FOR SELECT ...'.  But it's not
immediately clear to me why that's better than letting the calling
application do the DECLARE for itself.

            regards, tom lane


pgsql-novice by date:

Previous
From: Sergey Konoplev
Date:
Subject: Re: Return table and integer value
Next
From: Paul Smith
Date:
Subject: minimum hardware requirements for small postgres db