title: PostgreSQL return an Array or Record as a Row
body: <p>I'm trying to return a variable with a PostgreSQL function that returns row/rows so I can use <code>libpqxx</code> on the client side to iterate over it for example using:</p>
  
  <pre><code>for (pqxx::result::const_iterator row = result.begin(); row != result.end(); row++)
      {
          for (pqxx::const_row_iterator field = row.begin(); field != row.end(); field++) 
              {
                  cout &lt;&lt; field &lt;&lt; '\n';
              }
          }
  </code></pre>
  
  <p>This is my PostgresSQL function:</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION seal_diff_benchmark_pgsql(sealparams CHARACTER VARYING) RETURNS RECORD AS $outputVar$
  DECLARE
      tempVar1 CHARACTER VARYING;
      tempVar2 CHARACTER VARYING;
      outputVar1 TEXT[];
      outputVar record;
      sealArray TEXT[];
      execTime NUMERIC[];
  BEGIN
      FOR i IN 1..2 LOOP
          SELECT "Pickup_longitude", "Dropoff_longitude" INTO tempVar1, tempVar2 FROM public.nyc2015_09_enc WHERE id=i;
          sealArray := (SELECT public.seal_diff_benchmark(tempVar1, tempVar2, sealparams));
          outputVar1[i] := sealArray[1];
          execTime[i] := sealArray[2];
      END LOOP;
  
      SELECT UNNEST(outputVar1) INTO outputVAR;
      RETURN outputVar;
  END;
  $outputVar$ LANGUAGE plpgsql;
  </code></pre>
  
  <p>I also tried returning <code>outputVar1</code> as <code>TEXT[]</code>. My <code>field</code> variable on the client side holds <code>{foo, bar}</code> if I use returns <code>TEXT[]</code> or <code>(foo)</code> if I use returns <code>RECORD</code>. But this is not what I need, which is a row like return from a <code>TEXT[]</code> array or a <code>RECORD</code> variable without any <code>(), [], {}</code> chars at the beginning and at the end of the output.</p>
  
  <p>How can I change my PostgreSQL function to make it work? I think I'm missing something but I can't see what.</p>