Multi-column returns from pgsql

From: "Mark R(dot) Dingee" <mark(dot)dingee(at)cox(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Multi-column returns from pgsql
Date: 2005-07-22 15:49:21
Message-ID: 200507221149.21550.mark.dingee@cox.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi Everyone,

Does anyone know if/how it's possible to return multi-column sets from a pgsql
function? Right now I'm using something like the following as a work around

CREATE OR REPLACE FUNCTION my_func() returns SETOF TEXT AS '
DECLARE
rec record;
BEGIN
FOR rec IN SELECT txt1, txt2 FROM mytable LOOP
RETURN NEXT rec.txt1;
RETURN NEXT rec.txt2;
END LOOP;
RETURN;
END;' language 'plpgsql';

which leaves me parsing multiple records to achieve the desired end result.

Anyone have any thoughts?

Thanks,
Mark

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jim Buttafuoco 2005-07-22 16:56:15 Re: Multi-column returns from pgsql
Previous Message lucas 2005-07-22 14:03:40 Convert numeric to money