Re: Some questions about the array.

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: YUriy Zhuravlev <u(dot)zhuravlev(at)postgrespro(dot)ru>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Some questions about the array.
Date: 2015-10-12 22:53:43
Message-ID: CA+TgmoadZKV2r0ecANk_9rvbq8q7Gi2kUog0GA5HM3hA2-M_Qg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Oct 9, 2015 at 8:02 AM, YUriy Zhuravlev
<u(dot)zhuravlev(at)postgrespro(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2015-10-12 23:02:58 Re: Proposal: pg_confcheck - syntactic & semantic validation of postgresql configuration files
Previous Message Tom Lane 2015-10-12 22:41:06 Re: pg_ctl/pg_rewind tests vs. slow AIX buildfarm members