Re: Variadic parameters vs parameter defaults - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Variadic parameters vs parameter defaults
Date
Msg-id 18517.1229475988@sss.pgh.pa.us
Whole thread Raw
In response to Re: Variadic parameters vs parameter defaults  (Gregory Stark <stark@enterprisedb.com>)
List pgsql-hackers
Gregory Stark <stark@enterprisedb.com> writes:
> I'm inclined to think an implicit empty array makes the most sense. If a
> function-writer wants to enforce a minimum number of arguments they can check
> and throw an error.

> The question arises though whether it's useful to have any default other than
> an empty array. I don't see a compelling reason.

I'm not sure if that's useful either.  However, I think there are
probably quite a lot of cases where an empty array *isn't* desirable,
and so letting the current behavior alone seems okay, so long as there's
a way to override that and specify default = empty array when you do
want it to be possible.

The other way seems to boil down to "a variadic parameter has an
implicit default that you're not allowed to override", which doesn't
seem tremendously attractive.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Robert Treat
Date:
Subject: Re: Coding TODO for 8.4: Synch Rep
Next
From: Gregory Stark
Date:
Subject: Re: Another issue in default-values patch: defaults expanded too soon