Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id C082D9FA43A for ; Tue, 30 Jan 2007 23:44:23 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 76734-02 for ; Tue, 30 Jan 2007 23:44:20 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 0821E9FA39B for ; Tue, 30 Jan 2007 23:44:20 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id l0V3iHTd014950; Tue, 30 Jan 2007 22:44:17 -0500 (EST) To: Bruce Momjian cc: Roman Nowak , pgsql-bugs@postgresql.org Subject: Re: BUG #2913: Subscript on multidimensional array yields no value In-reply-to: <200701310200.l0V20Sd08345@momjian.us> References: <200701310200.l0V20Sd08345@momjian.us> Comments: In-reply-to Bruce Momjian message dated "Tue, 30 Jan 2007 21:00:28 -0500" Date: Tue, 30 Jan 2007 22:44:17 -0500 Message-ID: <14949.1170215057@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/176 X-Sequence-Number: 16793 Bruce Momjian writes: > Tom Lane wrote: >> This is not a bug, this is a definitional disagreement, and your TODO >> entry presupposes an answer that I don't particularly agree with. > Well, our documentation suggests thaat [1] is the same as [1:1]: > http://www.postgresql.org/docs/8.2/static/arrays.html#AEN5791 It says absolutely no such thing. A subscript expression involving m:n produces a "slice", hence an array of different dimensionality from the original, whereas a subscript expression not involving any colon produces a single element --- that is, not an array at all. You could make a fair case that the (ARRAY[[1,2],[3,4]])[1] example should throw an error instead of returning null. But to claim it is the same as a slice expression is a typing violation. regards, tom lane