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)