Received: from localhost (uranus.hub.org [200.46.204.60]) by postgresql.org (Postfix) with ESMTP id B19CC9FA20E for ; Sun, 5 Nov 2006 07:59:18 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.60]) (amavisd-new, port 10024) with ESMTP id 04471-10 for ; Sun, 5 Nov 2006 07:59:17 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.189]) by postgresql.org (Postfix) with ESMTP id 639729FA19A for ; Sun, 5 Nov 2006 07:59:17 -0400 (AST) Received: by nf-out-0910.google.com with SMTP id x37so2284064nfc for ; Sun, 05 Nov 2006 03:59:15 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=E48UYKTOQzrMZASj3o81PL/i0Nbqa7TAK8dGC52iJalYqn1tcweTQK1sCctNcCz8o/Gy/209WccMLkBpGOCtDyXFCLXrIdK8Nlnfdoy/vW1Y4mayMQ1IlY1XgmkhGyLnfG9fMU0K2XQ2KQlIZOy6mL0VQv9RxZDEXtqje1A3bZY= Received: by 10.82.114.3 with SMTP id m3mr1103871buc.1162727954542; Sun, 05 Nov 2006 03:59:14 -0800 (PST) Received: by 10.82.161.3 with HTTP; Sun, 5 Nov 2006 03:59:14 -0800 (PST) Message-ID: <1f30b80c0611050359l5208a40fo5276f7df3cf65371@mail.gmail.com> Date: Sun, 5 Nov 2006 16:59:14 +0500 From: imad To: "Mark Simon" Subject: Re: Create Function (SQL) Cc: pgsql-sql@postgresql.org In-Reply-To: <454D82CC.6090503@manngo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <454D82CC.6090503@manngo.net> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/54 X-Sequence-Number: 26706 You can return a record: create function thing(text) returns record as 'select * from whatever where id=$1' language sql; Hope this helps. --Imad www.EnterpriseDB.com On 11/5/06, Mark Simon wrote: > > I am trying to create a simple function using SQL rather than PGSQL. At > this point, it's just for the exercise. > > Is it possible to create a function similar to the following: > > create function thing(text) as select * from whatever where id=$1; > > Do I need to specify all of the columns from the table (whatever) as out > parameters, or as a return type, or can I have a generic table returned from > this? > > Thanks, > > Mark > > -- > > > Mark Simon > > Manngo Net Pty Ltd > > Phone/Fax: 1300 726 000 > mobile: 0411 246 672 > > email: mark@manngo.net > web: http://www.manngo.net > > Resume: http://mark.manngo.net