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: Wolfgang Walther <walther(at)technowledgy(dot)de>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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-29 15:11:43
Message-ID: CAKFQuwZu6G3GuWUS=8+VwwwHQBef5YaEnAPz6E2ZN3A1aXHUWg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Oct 28, 2020 at 11:46 PM Wolfgang Walther <walther(at)technowledgy(dot)de>
wrote:

> One reason for the lack of complaints so far could also be, that people
> don't realize it's actually possible to call variadic arguments in named
> notation at all. This fact is not at all obvious from the documentation,
> it's spread across different places.
>
>
As I look at this more I'm definitely agreeing that the documentation here
is problematic. Specifically, the fact that the only place about this
syntax is in a chapter under Extending SQ - SQL Functions, is not good. It
really needs to be in the Syntax chapter.

That said the one place this syntax is explicitly defined says:

"The array element parameters generated from a variadic parameter are
treated as not having any names of their own. This means it is not possible
to call a variadic function using named arguments (Section 4.3), except
when you specify VARIADIC."

And proceeds to give examples.

Given the volume of precautions listed in 10.3, Function Type Resolution,
it definitely seems like an imposing challenge to evaluate and change
behavior in this area.

In short, I agree that there is a need for a documentation patch, and may
even write one at some point in the future. As for making the last case
work, the concept has merit but my expectations are low.

David J.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2020-10-29 15:44:33 Re: Calling variadic function with default value in named notation
Previous Message Tom Lane 2020-10-29 14:01:52 Re: spring context cannot load when I use postgres 42.2.15 or higher