Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1taHgU-000Q2v-4o for pgsql-bugs@arkaria.postgresql.org; Tue, 21 Jan 2025 17:05:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1taHgT-001mxP-3q for pgsql-bugs@arkaria.postgresql.org; Tue, 21 Jan 2025 17:05:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1taHgS-001muO-RP for pgsql-bugs@lists.postgresql.org; Tue, 21 Jan 2025 17:05:00 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1taHgQ-000khH-0S for pgsql-bugs@lists.postgresql.org; Tue, 21 Jan 2025 17:05:00 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 50LH4us63356243; Tue, 21 Jan 2025 12:04:56 -0500 From: Tom Lane To: Jelte Fennema-Nio cc: pgsql-bugs@lists.postgresql.org Subject: Re: Combining array slicing and indexing causes incorrect/confusing results In-reply-to: References: Comments: In-reply-to Jelte Fennema-Nio message dated "Tue, 21 Jan 2025 17:35:17 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3356241.1737479096.1@sss.pgh.pa.us> Date: Tue, 21 Jan 2025 12:04:56 -0500 Message-ID: <3356242.1737479096@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Jelte Fennema-Nio writes: > Due to the way SubscriptingRef works there's no way for it to describe > a subscript sequence that both does a slice and a regular index in the > same SubscriptingRef. Well, yeah, because they're fundamentally different operations. A slice produces a value of the array type, a regular index operation produces a value of the element type. So if you mix the notations we assume you really meant slicing in each subscript. regards, tom lane