Re: functions are returns columns

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: "Michele Petrazzo - Unipex srl" <michele(dot)petrazzo(at)unipex(dot)it>, "Pgsql-Sql" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: functions are returns columns
Date: 2007-11-10 19:46:35
Message-ID: 19335.1194723995@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

Gregory Stark <stark(at)enterprisedb(dot)com> writes:
> You're almost there:

> CREATE FUNCTION getfoo (IN int, OUT int, OUT int) returns setof record(int,int) AS $$
> SELECT fooid, foosubid FROM foo WHERE fooid = $1;
> $$ LANGUAGE SQL;

Not quite --- it's just "returns setof record". The output column types
are defined by the OUT parameters. The only reason you need the returns
clause is to have a place to stick the "setof" specification ...

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gregory Stark 2007-11-10 21:04:06 Re: functions are returns columns
Previous Message Gregory Stark 2007-11-10 19:36:09 Re: functions are returns columns

Browse pgsql-sql by date

  From Date Subject
Next Message Gregory Stark 2007-11-10 21:04:06 Re: functions are returns columns
Previous Message Gregory Stark 2007-11-10 19:36:09 Re: functions are returns columns