Re: Some questions about the array.

Поиск
Список
Период
Сортировка
От Vitaly Burovoy
Тема Re: Some questions about the array.
Дата
Msg-id CAKOSWNk-+=QDn-7VH6ROex=t9fKyb8Q5ATxcQNQRfbkbtM6UKw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Some questions about the array.  (YUriy Zhuravlev <u.zhuravlev@postgrespro.ru>)
Ответы Re: Some questions about the array.
Список pgsql-hackers
On 11/9/15, YUriy Zhuravlev <u.zhuravlev@postgrespro.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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: Some questions about the array.
Следующее
От: YUriy Zhuravlev
Дата:
Сообщение: Re: Some questions about the array.