Re: proposal: fix corner use case of variadic fuctions usage

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, Vik Reykja <vikreykja(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: fix corner use case of variadic fuctions usage
Date: 2013-01-23 07:28:53
Message-ID: 9365.1358926133@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
> what should be result of concat(variadic NULL::int[])
> I enabled this use case, but what should be result?

I think there are two somewhat defensible theories:

(1) punt, and return NULL overall. So in this case the variadic
function would act as if it were STRICT. That seems a bit weird though
if the function is not strict otherwise.

(2) Treat the NULL as if it were a zero-length array, giving rise to
zero ordinary parameters. This could be problematic if the function
can't cope very well with zero parameters ... but on the other hand,
if it can't do so, then what will it do with VARIADIC '{}'::int[] ?

I lean a little bit towards (2) but it's definitely a judgment call.
Anybody have any other arguments one way or the other?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2013-01-23 08:07:03 Re: proposal: fix corner use case of variadic fuctions usage
Previous Message Pavel Stehule 2013-01-23 07:03:23 Re: proposal: fix corner use case of variadic fuctions usage

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2013-01-23 07:36:32 Re: WIP: index support for regexp search
Previous Message Pavel Stehule 2013-01-23 07:03:23 Re: proposal: fix corner use case of variadic fuctions usage