From chris@dronestudios.com Mon Feb 9 19:49:34 2004 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 2176ED1C9E1 for ; Mon, 9 Feb 2004 19:49:34 +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 95186-04 for ; Mon, 9 Feb 2004 15:49:18 -0400 (AST) Received: from ns.dronestudios.com (unknown [66.132.165.178]) by svr1.postgresql.org (Postfix) with ESMTP id 4BC1DD1D59F for ; Mon, 9 Feb 2004 15:49:12 -0400 (AST) Received: (qmail 21232 invoked from network); 9 Feb 2004 19:48:20 -0000 Received: from c-24-19-70-174.client.comcast.net (HELO ?192.168.1.103?) (24.19.70.174) by rumbleshock.com with SMTP; 9 Feb 2004 19:48:20 -0000 Subject: umlimited arguments on function From: Christian Hergert To: pgsql-sql@postgresql.org Content-Type: multipart/alternative; boundary="=-V5Sd7yqmJ5BeMRE1kHy2" Organization: Drone Studios Message-Id: <1076356148.15912.1.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 (1.4.5-7) Date: Mon, 09 Feb 2004 11:49:08 -0800 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/174 X-Sequence-Number: 16864 --=-V5Sd7yqmJ5BeMRE1kHy2 Content-Type: text/plain Content-Transfer-Encoding: 7bit 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. ~ chris --=-V5Sd7yqmJ5BeMRE1kHy2 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit 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.

~ chris --=-V5Sd7yqmJ5BeMRE1kHy2-- From xzilla@users.sourceforge.net Mon Feb 16 02:45:15 2004 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