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>, "Brendan Jurd" <direvus(at)gmail(dot)com> |
Subject: | Re: Variadic parameters vs parameter defaults |
Date: | 2008-12-17 17:45:28 |
Message-ID: | 200812171945.29674.peter_e@gmx.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wednesday 17 December 2008 06:03:06 Tom Lane wrote:
> "Brendan Jurd" <direvus(at)gmail(dot)com> writes:
> > So if I had these two functions ...
> >
> > var1(a int, b variadic int[])
> > var2(a int, b variadic anyarray)
> >
> > ... it would be okay to write var1(8), which resolves as var1(8,
> > array[]::int[]). But if I tried to write var2(8) I'd get an error.
> > Maybe something like "cannot determine type of missing variadic
> > arguments".
>
> Well, we could unify these behaviors if we insisted on an explicit
> default to omit the argument in both cases.
>
> var1(a int, b variadic int[] default '{}'::int[])
> var2(a int, b variadic anyarray default '{}'::text[]) -- perhaps
I would just pass an empty array if the type is clear and error out otherwise.
Mixing these things up makes things a lot more complicated for even normal
uses.
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2008-12-17 17:47:14 | Re: Variadic parameters vs parameter defaults |
Previous Message | Peter Eisentraut | 2008-12-17 17:43:10 | Re: Variadic parameters vs parameter defaults |