Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Zqlky-0007dE-HX for pgsql-docs@arkaria.postgresql.org; Mon, 26 Oct 2015 17:40:29 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1Zqlky-0003nw-0Q for pgsql-docs@arkaria.postgresql.org; Mon, 26 Oct 2015 17:40:28 +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 1Zqedy-00061Q-SP for pgsql-docs@postgresql.org; Mon, 26 Oct 2015 10:04:46 +0000 Received: from mail.hemio.de ([144.76.93.186]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Zqedv-0000Hq-RS for pgsql-docs@postgresql.org; Mon, 26 Oct 2015 10:04:46 +0000 X-Original-To-Masked: X-Original-To-Masked: Received: from user.client (localhost [144.76.93.186]) by mail.hemio.de (Postfix) with ESMTPSA id 4253F9B; Mon, 26 Oct 2015 11:04:41 +0100 (CET) Message-ID: <562DFAB8.9050507@hemio.de> Date: Mon, 26 Oct 2015 11:04:40 +0100 From: Michael Herold User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Icedove/31.8.0 MIME-Version: 1.0 To: Tom Lane , pgsql-docs@postgresql.org Subject: Re: ARRAY[1] || NULL <> array_append(ARRAY[1], NULL) References: <559DC0CE.90900@hemio.de> <32402.1436450457@sss.pgh.pa.us> In-Reply-To: <32402.1436450457@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -4.2 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-docs Precedence: bulk Sender: pgsql-docs-owner@postgresql.org I just got confused by another behavior of the || operator. I thought it might be appropriate to report it here. The docs say "the result retains the lower bound subscript of the left-hand operand’s outer dimension" [1]. That's again not true for corner cases. Expected: # SELECT '{0}'::int[] || '[15:16]={1,2}'; ---------- {0,1,2} Unexpected (lower bound is untouched): # SELECT '{}'::int[] || '[15:16]={1,2}'; --------------- [15:16]={1,2} Actually, I was looking for a way to reset the index lower bound of an array to the default. I didn't found a solution documented anywhere, [2] only works for known array sizes. So, it might also be worth stating ARRAY(SELECT UNNEST(...)) as a solution? [1]: [2]: -- Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs