Re: Some questions about the array. - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Some questions about the array.
Date
Msg-id CA+TgmoadZKV2r0ecANk_9rvbq8q7Gi2kUog0GA5HM3hA2-M_Qg@mail.gmail.com
Whole thread Raw
In response to Some questions about the array.  (YUriy Zhuravlev <u.zhuravlev@postgrespro.ru>)
List pgsql-hackers
On Fri, Oct 9, 2015 at 8:02 AM, YUriy Zhuravlev
<u.zhuravlev@postgrespro.ru> wrote:
> We were some of the issues associated with the behavior of arrays.
> 1. We would like to implement arrays negative indices (from the end) like in
> Python or Ruby: arr[-2]  or arr[1: -1]
> but as an array can be indexed in the negative area so it probably can not be
> done.

That seems like a complete non-starter because it would break backward
compatibility.  Our array implementation allows negative indexes:

rhaas=# select ('[-1:4]={3,1,4,1,5,9}'::int[])[-1];int4
------   3
(1 row)

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_ctl/pg_rewind tests vs. slow AIX buildfarm members
Next
From: Robert Haas
Date:
Subject: Re: Proposal: pg_confcheck - syntactic & semantic validation of postgresql configuration files