Re: Some questions about the array.

From: Vitaly Burovoy <vitaly(dot)burovoy(at)gmail(dot)com>
To: YUriy Zhuravlev <u(dot)zhuravlev(at)postgrespro(dot)ru>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Some questions about the array.
Date: 2015-11-09 12:33:28
Message-ID: CAKOSWNk-+=QDn-7VH6ROex=t9fKyb8Q5ATxcQNQRfbkbtM6UKw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11/9/15, YUriy Zhuravlev <u(dot)zhuravlev(at)postgrespro(dot)ru> wrote:
> On Monday 09 November 2015 12:48:54 you wrote:
>> I am sorry - it is looking pretty obscure. Really need this feature?
>
> IMHO yes.
> Now for write: array[~2:~-2] you need like:
> array[array_lower(array, 1)+3: array_upper(array, 1)-2]
>
> Worse when long names. Besides the extra functions calls.

You can write it as a separate function instead of changing current syntax.
Call would be like :
SELECT slice_abs('[-3:3]={1,2,3,4,5,6,7}'::int[], 2, -2) == {3,4,5,6}
SELECT slice_abs('[-3:3]={1,2,3,4,5,6,7}'::int[], 2, NULL) ==
{3,4,5,6,7} -- omitting boundaries
--
Best regards,
Vitaly Burovoy

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message YUriy Zhuravlev 2015-11-09 12:38:16 Re: Some questions about the array.
Previous Message YUriy Zhuravlev 2015-11-09 12:32:55 Re: Some questions about the array.