Re: Single-argument variant for array_length and friends?

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Brendan Jurd <direvus(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Single-argument variant for array_length and friends?
Date: 2013-03-21 06:32:21
Message-ID: CAFj8pRCqf6Q49T=Xw6+0KfeR5t+HSsQedzNrB3ZqLmMpTAY-Jg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2013/3/21 Brendan Jurd <direvus(at)gmail(dot)com>:
> On 21 March 2013 17:08, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>> 2013/3/21 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>>> I'm not entirely convinced that this is a good idea, but if we're going
>>> to allow it I would argue that "array_length(a)" should be defined as
>>> "array_length(a, 1)". The other possibilities are too complicated to
>>> explain in as few words.
>>>
>>
>> exactly
>>
>> +1
>
> Hi Pavel,
>
> Is your +1 to array_length(a) being defined as array_length(a,1), or
> to Tom's being unconvinced by the whole proposal? Or both?

If I though about it more, I like to more limit one parametric
array_length function just for only 1D array. So it is your A use
case. But I understand so this variant is not orthogonal. Hard to say,
what is better.

almost all operations are done on 1D arrays and for multidimensional
arrays I don't have a problem with more verbosity (it is better there
be more verbose).

Probably a most clean solution is Tom's proposal (from API
perspective) - with full ANSI/SQL SET implementation. So for 1D
operations user can use SET instead 1D arrays.

so Tom proposal is cleaner
your @a proposal is safer

any other opinions???

Regards

Pavel

>
> Cheers,
> BJ

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Brendan Jurd 2013-03-21 06:51:34 Re: Single-argument variant for array_length and friends?
Previous Message Brendan Jurd 2013-03-21 06:13:25 Re: Single-argument variant for array_length and friends?