| From: | PFC <lists(at)boutiquenumerique(dot)com> |
|---|---|
| To: | "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>, "George Weaver" <gweaver(at)shaw(dot)ca> |
| Cc: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: PL/PgSQL - returning multiple columns ... |
| Date: | 2005-02-03 18:15:04 |
| Message-ID: | opslmvnew2th1vuj@musicbox |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
On Thu, 3 Feb 2005 12:48:11 -0400 (AST), Marc G. Fournier
<scrappy(at)postgresql(dot)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)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2005-02-03 18:16:41 | Re: problem with backup and restore (probaly stupit newb thing) |
| Previous Message | Richard Huxton | 2005-02-03 17:38:20 | Re: problem with backup and restore (probaly stupit newb thing) |