title: Calling a function that returns a refcursor
body: <p>I am using Postgresql 8.3 and have the following simple function that will return a <code>refcursor</code>  to the client</p>
  <pre><code>CREATE OR REPLACE FUNCTION function_1() RETURNS refcursor AS $$
  DECLARE
          ref_cursor REFCURSOR;
  BEGIN
          OPEN ref_cursor FOR SELECT * FROM some_table;
          RETURN (ref_cursor);    
  END;
  $$ LANGUAGE plpgsql;
  </code></pre>
  <p>Now , I can use the following SQL commands to call this function and manipulate the returned cursor ,but the cursor name is automatically generated by the PostgreSQL</p>
  <pre><code>BEGIN;
  SELECT function_1();  --It will output the generated cursor name , for example , &quot;&lt;unnamed portal 11&gt;&quot; ;
  FETCH 4   from  &quot;&lt;unnamed portal 11&gt;&quot;; 
  COMMIT;
  </code></pre>
  <p>Besides explicitly declaring the cursor name as the input parameter of the function as described by  <a href="http://www.postgresql.org/docs/8.3/interactive/plpgsql-cursors.html" rel="nofollow noreferrer">38.7.3.5. Returning Cursors</a>, can I declare my own cursor name and use this cursor name to manipulate the returned cursor instead of Postgresql automatically generates for me ?</p>
  <p>If not, are there any commands that can get the generated cursor name ?</p>