X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3E52DD1DD71 for ; Mon, 16 Feb 2004 02:45:15 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 58622-09 for ; Sun, 15 Feb 2004 22:45:17 -0400 (AST) Received: from lakemtao02.cox.net (lakemtao02.cox.net [68.1.17.243]) by svr1.postgresql.org (Postfix) with ESMTP id 2B1E7D1DCF3 for ; Sun, 15 Feb 2004 22:45:13 -0400 (AST) Received: from [192.168.0.13] ([68.105.168.121]) by lakemtao02.cox.net (InterMail vM.5.01.06.05 201-253-122-130-105-20030824) with ESMTP id <20040216024515.XDBM19763.lakemtao02.cox.net@[192.168.0.13]>; Sun, 15 Feb 2004 21:45:15 -0500 From: Robert Treat To: Christian Hergert , pgsql-sql@postgresql.org Subject: Re: umlimited arguments on function Date: Sun, 15 Feb 2004 21:45:15 -0500 User-Agent: KMail/1.5 References: <1076356148.15912.1.camel@localhost.localdomain> In-Reply-To: <1076356148.15912.1.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200402152145.15276.xzilla@users.sourceforge.net> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/190 X-Sequence-Number: 16880 On Monday 09 February 2004 14:49, Christian Hergert wrote: > Is it possible to write a function (in sql or plpgsql) that allows for > an unknown amount of arguments? Something similar to C's printf() > function. > AFAIK no, but I know of two possible work arounds... first is to write multiple copies of the function to accept the different number of argument combinations you need. the other thing i've done in the past is to create the function as accepting a array as one of its inputs and then handle the array structure as needed. (bonus points for doing the second method in 7.3 where its much more challenging.) HTH, Robert Treat -- Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL