title: Using multi-column SETOF result from a PL/pgSQL function in via jdbc
body: <p>When executing a PL/pgSQL function returning a result of a query, Postgresql jdbc driver seems to return only a single column ResultSet. I cannot figure out how to access the members of the "tuple".</p>
  
  <p>For example, if I have a database</p>
  
  <pre><code>CREATE TABLE things (id SERIAL PRIMARY KEY, name VARCHAR);
  INSERT INTO things (name) VALUES ('pen'), ('eraser');
  
  -- function to return all rows as a SETOF
  CREATE OR REPLACE FUNCTION list_things () RETURNS SETOF things AS $$
  BEGIN
      RETURN QUERY SELECT id, name FROM things;
  END
  $$ LANGUAGE PLPGSQL;
  </code></pre>
  
  <p>and I use the PL/pgSQL function <em>list_things()</em> from Java like this:</p>
  
  <pre><code>static void printThings(Connection c) throws SQLException {
      Statement s = c.createStatement();
      String sql = "SELECT list_things()";
      ResultSet rs = s.getResultSet();
      while (rs.next()) {
          // is String all I can make of it?
          System.out.println(rs.getString(1));
          // how can I access the name member of result row?
      }
  }
  </code></pre>
  
  <p>The output looks like</p>
  
  <pre><code>(1,pen)
  (2,eraser)
  </code></pre>
  
  <p>How can I access the members of tuples other than by parsing the string?</p>