Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 0C5899F95C2 for ; Sat, 10 Nov 2007 15:46:44 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 03251-07 for ; Sat, 10 Nov 2007 15:46:38 -0400 (AST) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 5BFF49F925E for ; Sat, 10 Nov 2007 15:46:38 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id lAAJkZ3i019336; Sat, 10 Nov 2007 14:46:36 -0500 (EST) To: Gregory Stark cc: "Michele Petrazzo - Unipex srl" , "Pgsql-Sql" Subject: Re: functions are returns columns In-reply-to: <878x55dhau.fsf@oxford.xeocode.com> References: <4734B921.5050704@unipex.it> <162867790711091235i7e77abcch27731d91285949b6@mail.gmail.com> <4735EC6F.5050908@unipex.it> <878x55dhau.fsf@oxford.xeocode.com> Comments: In-reply-to Gregory Stark message dated "Sat, 10 Nov 2007 19:36:09 +0000" Date: Sat, 10 Nov 2007 14:46:35 -0500 Message-ID: <19335.1194723995@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200711/40 X-Sequence-Number: 29568 Gregory Stark 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