Re: Variadic parameters vs parameter defaults

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Variadic parameters vs parameter defaults
Date: 2008-12-17 01:06:28
Message-ID: 18517.1229475988@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Gregory Stark <stark(at)enterprisedb(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Gregory Stark 2008-12-17 01:11:24 Re: Another issue in default-values patch: defaults expanded too soon
Previous Message Robert Treat 2008-12-17 01:06:01 Re: Coding TODO for 8.4: Synch Rep