Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aB4GR-0000bQ-A8 for pgsql-hackers@arkaria.postgresql.org; Mon, 21 Dec 2015 17:28:51 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aB4GQ-0006ww-KS for pgsql-hackers@arkaria.postgresql.org; Mon, 21 Dec 2015 17:28:50 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aB4GP-0006wf-Me for pgsql-hackers@postgresql.org; Mon, 21 Dec 2015 17:28:49 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aB4GM-0004A5-Ox for pgsql-hackers@postgresql.org; Mon, 21 Dec 2015 17:28:48 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id tBLHSh39002854; Mon, 21 Dec 2015 12:28:43 -0500 From: Tom Lane To: Uriy Zhuravlev cc: pgsql-hackers@postgresql.org Subject: Re: Some questions about the array. In-reply-to: <6ac195fe-b835-4d2d-8edc-11db52118cbf@postgrespro.ru> References: <2987745.PueTkqGxbO@dinodell> <1538864.xaPm21N10Q@dinodell> <56619AB0.2070802@sigaev.ru> <2723429.ZaCixaFn1x@dinodell> <6ac195fe-b835-4d2d-8edc-11db52118cbf@postgrespro.ru> Comments: In-reply-to Uriy Zhuravlev message dated "Mon, 21 Dec 2015 19:49:48 +0300" Date: Mon, 21 Dec 2015 12:28:43 -0500 Message-ID: <2853.1450718923@sss.pgh.pa.us> 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 Uriy Zhuravlev writes: >> I'm dubious that the parsetree representation is well-chosen. >> Probably a single is_slice flag would have been better. > What do you mean? This flag is for what? You are about the A_Indices > node(lidx_default/uidx_default)? Yes. Those flags are partially redundant with the subtree pointers being NULL, and there are combinations that would be invalid (such as lidx_default being set but lidx not being null), and it's pretty unobvious what the difference in representation is between a non-slice case and a slice case with only the upper index provided. In fact, since you have five syntaxes to represent, it's impossible for the two bools to distinguish them all, which means that at least one case *must* be identified by null-ness of a pointer contradicting what the corresponding bool's setting would imply. So this just seems like a mess to me. I think it would come out cleaner if you had just one bool is_slice, which corresponds directly to whether a colon was present. The four sub-possibilities of colon notation would be represented by combinations of null and non-null lidx and uidx. With is_slice false, the only valid case is lidx==NULL, uidx!=NULL, as before for non-slice notation. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers