From: | Gregory Stark <stark(at)enterprisedb(dot)com> |
---|---|
To: | "Michele Petrazzo - Unipex srl" <michele(dot)petrazzo(at)unipex(dot)it> |
Cc: | "Pgsql-Sql" <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: functions are returns columns |
Date: | 2007-11-10 19:36:09 |
Message-ID: | 878x55dhau.fsf@oxford.xeocode.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-sql |
"Michele Petrazzo - Unipex srl" <michele(dot)petrazzo(at)unipex(dot)it> writes:
> I try with:
> CREATE FUNCTION getfoo (IN int, OUT int, OUT int) AS $$
> SELECT fooid, foosubid FROM foo WHERE fooid = $1;
> $$ LANGUAGE SQL;
>
> but only one row returned...
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;
The return type if present has to match the OUT (and BOTH) parameters.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
Get trained by Bruce Momjian - ask me about EnterpriseDB's PostgreSQL training!
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-11-10 19:46:35 | Re: functions are returns columns |
Previous Message | Bruce Momjian | 2007-11-10 19:20:15 | Re: High Availability, Load Balancing, and Replication Feature Matrix |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-11-10 19:46:35 | Re: functions are returns columns |
Previous Message | Michele Petrazzo - Unipex srl | 2007-11-10 17:37:51 | Re: functions are returns columns |