X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 938B9D1B18C for ; Mon, 21 Jun 2004 08:53:02 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64059-02 for ; Mon, 21 Jun 2004 11:52:56 +0000 (GMT) Received: from mail231.csoft.net (resin.csoft.net [63.111.22.86]) by svr1.postgresql.org (Postfix) with SMTP id 60E92D1B18A for ; Mon, 21 Jun 2004 08:52:49 -0300 (ADT) Received: (qmail 28141 invoked from network); 21 Jun 2004 11:52:48 -0000 Received: from unknown (HELO chezphil.org) (63.111.27.87) by mail231.csoft.net with SMTP; 21 Jun 2004 11:52:48 -0000 Content-Disposition: inline Content-Transfer-Encoding: binary Content-Type: text/plain MIME-Version: 1.0 X-Mailer: MIME::Lite 3.01 (F2.72; A1.17; B2.21; Q2.21) From: "Phil Endecott" To: "Pradeepkumar, Pyatalo (IE10)" , pgsql-sql@postgresql.org Subject: Re: Function Parameters - need help !!! Date: Mon, 21 Jun 2004 07:52:48 -0400 X-Mailer: Phil's WebMail Message-Id: <2733210@chezphil.org> In-Reply-To: <77ED2BF75D59D1439F90412CC5B109740DCFBDCC@ie10-sahara.hiso.honeywell.com> References: <77ED2BF75D59D1439F90412CC5B109740DCFBDCC@ie10-sahara.hiso.honeywell.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.6 tagged_above=0.0 required=5.0 tests=PLING_PLING, UPPERCASE_25_50 X-Spam-Level: * X-Archive-Number: 200406/193 X-Sequence-Number: 18138 Hi, Quote from Section 37.11 of the manual: # There are no default values for parameters in PostgreSQL. # You can overload function names in PostgreSQL. This is often used to work around the lack of default parameters. So for your example: > CREATE FUNCTION test(integer,integer) RETURNS INTEGER AS ' > ... you should be able to write: CREATE FUNCTION test(integer) RETURNS INTEGER AS ' BEGIN test($1, default_value_for_param2); END; ' LANGUAGE 'plpgsql'; and also: CREATE FUNCTION test() RETURNS INTEGER AS ' BEGIN test(default_value_for_param1); END; ' LANGUAGE 'plpgsql'; Hope this is what you were looking for. --Phil.