X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 68E7E11F6029 for ; Fri, 28 Apr 2006 08:04:28 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 39877-07 for ; Fri, 28 Apr 2006 08:04:20 -0300 (ADT) X-Greylist: delayed 00:05:21.757948 by SQLgrey- Received: from vsmtp4.tin.it (vsmtp4.tin.it [212.216.176.224]) by postgresql.org (Postfix) with ESMTP id A073F11F6058 for ; Fri, 28 Apr 2006 08:04:18 -0300 (ADT) Received: from [192.168.2.5] (87.8.113.153) by vsmtp4.tin.it (7.2.072.1) (authenticated as apbertolini@virgilio.it) id 44469C83008106F8 for pgsql-sql@postgresql.org; Fri, 28 Apr 2006 13:00:16 +0200 Message-ID: <4451F56F.8030608@computer.org> Date: Fri, 28 Apr 2006 12:58:55 +0200 From: Alexis Paul Bertolini User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: set return function is returning a single record, multiple References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200604/200 X-Sequence-Number: 25009 > CREATE or replace FUNCTION ftoc9() RETURNS setof structrankmaster2 > LANGUAGE 'plpgsql' > > AS' DECLARE > > rowdata pss%rowtype; > > BEGIN for i in 1..3 loop > > select * into rowdata from pss ; > > return next rowdata ; > > end loop; > > return; > > end'; > The query should be outside the loop, otherwise you are re-running the query each time :-) Alex