Re: Single-argument variant for array_length and friends? - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: Single-argument variant for array_length and friends?
Date
Msg-id CAFj8pRCqf6Q49T=Xw6+0KfeR5t+HSsQedzNrB3ZqLmMpTAY-Jg@mail.gmail.com
Whole thread Raw
In response to Re: Single-argument variant for array_length and friends?  (Brendan Jurd <direvus@gmail.com>)
Responses Re: Single-argument variant for array_length and friends?  (Brendan Jurd <direvus@gmail.com>)
List pgsql-hackers
2013/3/21 Brendan Jurd <direvus@gmail.com>:
> On 21 March 2013 17:08, Pavel Stehule <pavel.stehule@gmail.com> wrote:
>> 2013/3/21 Tom Lane <tgl@sss.pgh.pa.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



pgsql-hackers by date:

Previous
From: Brendan Jurd
Date:
Subject: Re: Single-argument variant for array_length and friends?
Next
From: Brendan Jurd
Date:
Subject: Re: Single-argument variant for array_length and friends?