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

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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:03:23
Message-ID: CAFj8pRBbK15fBNVdWB_r6d5JRxm3i4QEHxrb7dsvLyGdJBp+ig@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Hello

I sent a updated patch, but still I am not sure in one topic

> Also, I'm not sure that it's appropriate to throw an error if the given
> argument is null or not an array. Previous versions did not throw an
> error in such cases. Perhaps just fall back to behaving as if it
> weren't marked VARIADIC? You could possibly make an argument for
> not-an-array-type being an error, since that's a statically inconsistent
> type situation, but I really don't like a null value being an error.
> A function could easily receive a null value for an array parameter
> that it wants to pass on to format() or concat().

what should be result of concat(variadic NULL::int[])

I enabled this use case, but what should be result?

usually concat() function needs one parameter as minimum and then
returns empty string or some string. But concat(variadic NULL::int[])
is +/- zero parameters call. A result should be empty string or NULL?

I am vote returning NULL and I have a only one argument

If concat(variadic NULL::int[]) returns NULL, then it returns
different "value" than concat(variadic '{}'::int[]) what is correct.
Opposite behave returns empty string in both variants and It is some
when I don't feel well.

Regards

Pavel

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2013-01-23 07:28:53 Re: proposal: fix corner use case of variadic fuctions usage
Previous Message Tom Lane 2013-01-23 03:05:11 Re: Fwd: Question on Trigram GIST indexes

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2013-01-23 07:28:53 Re: proposal: fix corner use case of variadic fuctions usage
Previous Message Craig Ringer 2013-01-23 06:55:55 Re: Visual Studio 2012 RC