Re: umlimited arguments on function

From: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>
To: Christian Hergert <chris(at)dronestudios(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: umlimited arguments on function
Date: 2004-02-16 02:45:15
Message-ID: 200402152145.15276.xzilla@users.sourceforge.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message news.postgresql.org 2004-02-16 03:29:42 CHAR(n) always trims trailing spaces in 7.4
Previous Message Tom Lane 2004-02-15 22:02:11 Re: Unable to convert date to tm