Re: Variadic parameters vs parameter defaults

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Variadic parameters vs parameter defaults
Date: 2008-12-17 17:43:10
Message-ID: 200812171943.11133.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wednesday 17 December 2008 02:07:35 Tom Lane wrote:
> Oh, and another thing --- should variadic parameters be defaultable?
> The current patch doesn't allow it but it looks more like an oversight
> than anything that was thought through. The boundary case for variadic
> parameters is a bit weird already:
>
> regression=# create function fv (f1 int, f2 variadic int[]) returns int
> regression-# as 'select $1' language sql;
> CREATE FUNCTION

> regression=# select fv(1);
> ERROR: function fv(integer) does not exist
> LINE 1: select fv(1);
> ^
> HINT: No function matches the given name and argument types. You might
> need to add explicit type casts.

That looks like a bug to me. Anything that you can do with 1 to N items
should also work for zero.

Also, in C, variadic functions are quite commonly called with zero arguments
in the variadic position.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2008-12-17 17:45:28 Re: Variadic parameters vs parameter defaults
Previous Message Alvaro Herrera 2008-12-17 17:25:50 Re: DTrace probes patch