Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 129259FB3EB for ; Sat, 31 Mar 2007 09:56:01 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 97463-05 for ; Sat, 31 Mar 2007 09:55:50 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id 7774F9FB30F for ; Sat, 31 Mar 2007 09:55:55 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.8/8.13.8) with ESMTP id l2VCtljT002080 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 31 Mar 2007 06:55:50 -0600 (MDT) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.8/8.13.8) with ESMTP id l2VCtkvB023872; Sat, 31 Mar 2007 06:55:46 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.8/8.13.8/Submit) id l2VCtkdA023871; Sat, 31 Mar 2007 06:55:46 -0600 (MDT) (envelope-from mfuhr) Date: Sat, 31 Mar 2007 06:55:46 -0600 From: Michael Fuhr To: Karthikeyan Sundaram Cc: pgsql-sql@postgresql.org Subject: Re: plpgsql function return array Message-ID: <20070331125546.GA23812@winnie.fuhr.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/362 X-Sequence-Number: 28000 On Sat, Mar 31, 2007 at 12:43:44AM -0700, Karthikeyan Sundaram wrote: > Hi, I am using Postgres 8.1.0. I have a requirement. I will > create a function accepting few parameters. This will check into > various tables and give back an array of values. I want to use the > pgpsql block. I know that we can create using language sql. Is > it possible to return an array from the function? Please guide me. See the documentation for how to declare a function's return type, how to return values from a function, and how to build and manipulate arrays: http://www.postgresql.org/docs/8.2/interactive/sql-createfunction.html http://www.postgresql.org/docs/8.2/interactive/plpgsql-overview.html http://www.postgresql.org/docs/8.2/interactive/plpgsql-control-structures.html#PLPGSQL-STATEMENTS-RETURNING http://www.postgresql.org/docs/8.2/interactive/arrays.html http://www.postgresql.org/docs/8.2/interactive/functions-array.html If you're having a specific problem then please post the code you're running and describe how its behavior differs from what you expect. -- Michael Fuhr