Re: PL/PgSQL - returning multiple columns ... - Mailing list pgsql-sql

From PFC
Subject Re: PL/PgSQL - returning multiple columns ...
Date
Msg-id opslmvnew2th1vuj@musicbox
Whole thread Raw
In response to Re: PL/PgSQL - returning multiple columns ...  ("Marc G. Fournier" <scrappy@postgresql.org>)
List pgsql-sql
On Thu, 3 Feb 2005 12:48:11 -0400 (AST), Marc G. Fournier  
<scrappy@postgresql.org> wrote:

>
> Perfect, worked like a charm ... but the RETURNS still needs to be a  
> SETOF, other then that, I'm 'away to the races' ... thanks :)
No SETOF necessary :

CREATE TYPE mytype AS ( number INTEGER, blah TEXT );

CREATE OR REPLACE FUNCTION myfunc( INTEGER ) RETURNS mytype LANGUAGE  
plpgsql AS  $$ DECLARE _retval mytype; BEGIN _retval.number=$1;  
_retval.blah='yeah'; RETURN _retval; END;$$;

SELECT myfunc(22);  myfunc
----------- (22,yeah)
(1 ligne)

SELECT * FROM myfunc(22); number | blah
--------+------     22 | yeah
(1 ligne)


pgsql-sql by date:

Previous
From: Richard Huxton
Date:
Subject: Re: problem with backup and restore (probaly stupit newb thing)
Next
From: Tom Lane
Date:
Subject: Re: problem with backup and restore (probaly stupit newb thing)