Re: Variadic parameters vs parameter defaults

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Gregory Stark <stark(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org, Brendan Jurd <direvus(at)gmail(dot)com>
Subject: Re: Variadic parameters vs parameter defaults
Date: 2008-12-18 09:48:53
Message-ID: 494A1C85.6050108@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Yeah, I don't like putting extra restrictions on the polymorphic case
> either. Also, see my nearby note about how letting fewer defaults win
> over more defaults might be unsafe. Consider
>
> foo (f1 int)
> foo (f1 int, f2 variadic int[])
>
> If the system allows f2 to be defaulted to zero elements, then these two
> functions would have to be considered ambiguous under the stricter rule.
> This would make it *impossible* for the user to override the default
> zero-argument behavior, even with the trick of using an additional
> function.

Hmm, that use case might best be addressed by allowing the variadic
argument to be omitted (or defaulted) if all previous arguments are
omittable.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2008-12-18 10:04:46 Re: Function with defval returns error
Previous Message Simon Riggs 2008-12-18 09:40:27 Re: Preventing index scans for non-recoverable index AMs