X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 47F1D475ECE for ; Sat, 29 Mar 2003 11:51:44 -0500 (EST) Received: from joeconway.com (66-146-172-86.skyriver.net [66.146.172.86]) by postgresql.org (Postfix) with ESMTP id 9E2DF475E82 for ; Sat, 29 Mar 2003 11:51:43 -0500 (EST) Received: from [192.168.5.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 4.0.4) with ESMTP-TLS id 1679120; Sat, 29 Mar 2003 09:28:17 -0800 Message-ID: <3E85CE8B.3010700@joeconway.com> Date: Sat, 29 Mar 2003 08:49:15 -0800 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Franco Bruno Borghesi Cc: list@racistnames.com, pgsql-sql@postgresql.org Subject: Re: returning composite types. References: <200303282020.25997.franco@akyasociados.com.ar> <3E84E983.10206@racistnames.com> <200303291320.05734.franco@akyasociados.com.ar> In-Reply-To: <200303291320.05734.franco@akyasociados.com.ar> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=-34.8 required=5.0 tests=BAYES_10,EMAIL_ATTRIBUTION,IN_REP_TO,REFERENCES, REPLY_WITH_QUOTES,USER_AGENT_MOZILLA_UA autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200303/636 X-Sequence-Number: 12674 Franco Bruno Borghesi wrote: > ok, soy you're telling me that the only way to return a composite type is > using a set of them, even if I know my function will allways return 1 record. Try this: create type foo as (f1 int, f2 text); create or replace function retfoo(int, text) returns foo as ' declare result foo%ROWTYPE; begin select into result $1, $2; return result; end; ' language 'plpgsql'; regression=# select * from retfoo(2,'b'); f1 | f2 ----+---- 2 | b (1 row) Joe