Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id B97E49F9EF0 for ; Sun, 5 Nov 2006 02:51:08 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 12750-01 for ; Sun, 5 Nov 2006 06:51:04 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 8DE629FA001 for ; Sun, 5 Nov 2006 02:51:04 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from localhost.localdomain (unknown [58.105.225.59]) by svr4.postgresql.org (Postfix) with ESMTP id 0515F5AF03C for ; Sun, 5 Nov 2006 06:21:07 +0000 (GMT) Received: from [127.0.0.1] ([192.168.1.5]) by localhost.localdomain (8.13.1/8.12.11) with ESMTP id kA56L0e2013220 for ; Sun, 5 Nov 2006 17:21:03 +1100 Message-ID: <454D82CC.6090503@manngo.net> Date: Sun, 05 Nov 2006 17:21:00 +1100 From: Mark Simon User-Agent: Thunderbird 1.5.0.7 (Windows/20060909) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Create Function (SQL) Content-Type: multipart/alternative; boundary="------------050604060907090105080608" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.271 tagged_above=0 required=5 tests=BAYES_50, FORGED_RCVD_HELO, HTML_50_60, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200611/52 X-Sequence-Number: 26704 This is a multi-part message in MIME format. --------------050604060907090105080608 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 --------------050604060907090105080608 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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

--------------050604060907090105080608--