title: Update record of a cursor where the table name is a parameter
body: <p>I am adjusting some PL/pgSQL code so my <code>refcursor</code> can take the table name as parameter.  Therefore I changed the following line:</p>
  <pre><code>declare
   pointCurs CURSOR FOR SELECT * from tableName for update;
  </code></pre>
  <p>with this one:</p>
  <pre><code>OPEN pointCurs FOR execute 'SELECT * FROM ' || quote_ident(tableName) for update;
  </code></pre>
  <p>I adjusted the loop, and voilà, the loop went through. Now at some point in the loop I needed to update the record (pointed by the cursor) and I got stuck. How should I properly adjust the following line of code?</p>
  <pre><code>UPDATE tableName set tp_id = pos where current of pointCurs;
  </code></pre>
  <p>I fixed the quotes for the <code>tableName</code> and <code>pos</code> and added the <code>EXECUTE</code> clause at the beginning, but I get the error on the <code>where current of pointCurs</code>.</p>
  <h3>Questions:</h3>
  <ol>
  <li>How can I update the record?</li>
  <li>The function was working properly for tables from the public schema and failed for tables from other schemas (e.g., trace.myname).</li>
  </ol>
  <p>Any comments are highly appreciated..</p>