Re: Calling variadic function with default value in named notation

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Wolfgang Walther <walther(at)technowledgy(dot)de>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: Calling variadic function with default value in named notation
Date: 2020-10-28 21:34:51
Message-ID: CAKFQuwbmUfAQyXAD1PG2XGvWfRkziMi-9PpTHU5Lk=qrPAUSbg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Oct 28, 2020 at 2:18 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> One could imagine saying that if the function has a variadic last
> parameter, then we can match that to zero or more positional arguments
> after the last named argument. Not sure that that would be a good
> idea though, or how hard it'd be to implement. It'd be a pretty
> radical departure from the rules for non-variadic functions.
>

I too failed to realize that there was an implied, required, positional,
parameter, of cardinality zero, following the named parameter. I see no
reason to make that case work. I'm doubtful additional words in the
documentation, examples or otherwise, would have helped people commit this
edge case to memory. The error message would be of benefit but IMO it
isn't worth the effort given the sparsity of complaints and the assumed
rarity that all three of these dynamics come into play in order to have an
obscure doesn't work scenario.

David J.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Wolfgang Walther 2020-10-29 06:46:07 Re: Calling variadic function with default value in named notation
Previous Message Tom Lane 2020-10-28 21:18:19 Re: Calling variadic function with default value in named notation