Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZkZb6-0003MP-E1 for pgsql-hackers@arkaria.postgresql.org; Fri, 09 Oct 2015 15:28:40 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZkZb5-0001Gf-K4 for pgsql-hackers@arkaria.postgresql.org; Fri, 09 Oct 2015 15:28:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZkZZm-0008Ey-M1 for pgsql-hackers@postgresql.org; Fri, 09 Oct 2015 15:27:18 +0000 Received: from relay3-d.mail.gandi.net ([2001:4b98:c:538::195]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1ZkZZj-0003By-Ht for pgsql-hackers@postgresql.org; Fri, 09 Oct 2015 15:27:18 +0000 Received: from mfilter48-d.gandi.net (mfilter48-d.gandi.net [217.70.178.179]) by relay3-d.mail.gandi.net (Postfix) with ESMTP id 95897A80B8; Fri, 9 Oct 2015 17:27:12 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter48-d.gandi.net Received: from relay3-d.mail.gandi.net ([IPv6:::ffff:217.70.183.195]) by mfilter48-d.gandi.net (mfilter48-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id 0YUsrWohhCCq; Fri, 9 Oct 2015 17:27:11 +0200 (CEST) X-Originating-IP: 98.122.164.227 Received: from [192.168.10.146] (unknown [98.122.164.227]) (Authenticated sender: adsend@dunslane.net) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id D241BA80AA; Fri, 9 Oct 2015 17:27:10 +0200 (CEST) Subject: Re: Some questions about the array. To: YUriy Zhuravlev , pgsql-hackers@postgresql.org References: <2987745.PueTkqGxbO@dinodell> From: Andrew Dunstan Message-ID: <5617DCC6.9080605@dunslane.net> Date: Fri, 9 Oct 2015 11:27:02 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <2987745.PueTkqGxbO@dinodell> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 10/09/2015 08:02 AM, YUriy Zhuravlev 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. > 2. We would like to add the ability be omitted boundaries in the slice. > Example: arr[2:] or arr[:2]. But there was a problem with the update of an > empty array: > arr[1:][1:] = {1,2,3,4,5,6} can be interpreted as > arr[1:3][1:2] or arr[1:2] [1:3] or [1:1], [1:6] > > What is the history of the emergence of such arrays? Maybe something can be > improved? > > P.S. I would like List datatype as in Python. Is there any fundamental > objections? Or we just did not have the time and enthusiasm before? > The current implementation I would call vectors or matrices but not arrays. > IMHO > > The name array is now far too baked in to change it. jsonb and json arrays have many of the characteristics you seem to want. They are always 0-based and negative indexes count from the end. They also don't have to be regular, unlike our native arrays. cheers andrew -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers