pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mark R. Dingee <mark.dingee@cox.net>
To: pgsql-sql@postgresql.org
Subject: Multi-column returns from pgsql
Date: Fri, 22 Jul 2005 11:49:21 -0400
Message-ID: <200507221149.21550.mark.dingee@cox.net> (raw)

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





view thread (4+ messages)  latest in thread

Message-ID: <200507221149.21550.mark.dingee@cox.net>
Permalink:  ../200507221149.21550.mark.dingee@cox.net/
Also on:    postgresql.org/message-id/200507221149.21550.mark.dingee@cox.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mark.dingee@cox.net
  Subject: Re: Multi-column returns from pgsql
  In-Reply-To: <200507221149.21550.mark.dingee@cox.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox